Пример #1
0
        public PublishDisruptor(IEndpoint endpoint, int maxSize, int bufferSize, ILoader loader)
        {
            var list = new IEventHandler <PublishData>[]
            {
                new EventMarshaler(maxSize, loader),
                new EventPublisher(endpoint),
            };

            _disruptor = new DataHandlingSequencer <PublishData>(SequencerFactoryEntry.NewPublishData, bufferSize);
            _disruptor.SetFunctions(list).HandleExeceptionWith(new ExceptionHandler <PublishData>());
            //ghi nhan du lieu
            _disruptor.Start();
        }
Пример #2
0
        public ReceiveDisruptor(IProcess processor, int bufferSize, bool isWorker = false, bool isBStarMode = false, WorkerType?workerType = null)
        {
            _disruptor = new DataHandlingSequencer <ReceiveData>(SequencerFactoryEntry.NewReceiveData, bufferSize);
            var listTasks = new IEventHandler <ReceiveData>[]
            {
                new EventUnMarshaler(processor, isWorker, isBStarMode),
                new EventProcessor(processor)
            };

            _disruptor.SetFunctions(listTasks).HandleExeceptionWith(new ExceptionHandler <ReceiveData>());

            //ghi nhan du lieu chay
            _disruptor.Start();
        }