Beispiel #1
0
        public PublishEndpoint(EventStorageWriter eventStorageWriter, ResConfiguration config)
        {
            var ctx = NetMQContext.Create();
            _ctx = ctx;

            var outBuffer = new OutBuffer(config.PublishEndpoint.BufferSize);
            var dispatcher = new TcpMessageDispatcher();

            dispatcher.Register(ResCommands.AppendCommit, new CommitHandler(eventStorageWriter, outBuffer));

            MessageProcessor messageProcessor = new TcpIncomingMessageProcessor(dispatcher);
            messageProcessor = new ErrorHandlingMessageProcessor(messageProcessor);

            //important...the factory method parameter must "create" the gateway, threading issue otherwise.
            Logger.Debug("[CommitEndpoint] Initialising Transceiver. Endpoint: {0}", config.PublishEndpoint.Endpoint);
            _transceiver = new Transceiver(() => new TcpGateway(ctx, config.PublishEndpoint.Endpoint, messageProcessor), outBuffer);
        }
Beispiel #2
0
        public QueueEndpoint(QueueStorage storage, ResConfiguration config)
        {
            var ctx = NetMQContext.Create();
            _ctx = ctx;

            var outBuffer = new OutBuffer(config.QueueEndpoint.BufferSize);
            var dispatcher = new TcpMessageDispatcher();

            dispatcher.Register(ResCommands.SubscribeToQueue, new Queues.SubscribeHandler(storage, outBuffer));
            dispatcher.Register(ResCommands.AcknowledgeQueue, new Queues.AcknowledgeHandler(storage, outBuffer));

            MessageProcessor messageProcessor = new TcpIncomingMessageProcessor(dispatcher);
            messageProcessor = new ErrorHandlingMessageProcessor(messageProcessor);

            //important...the factory method parameter must "create" the gateway, threading issue otherwise.
            Logger.Debug("[QueueEndpoint] Initialising Transceiver. Endpoint: {0}", config.QueueEndpoint.Endpoint);
            _transceiver = new Transceiver(() => new TcpGateway(ctx, config.QueueEndpoint.Endpoint, messageProcessor), outBuffer);
        }
Beispiel #3
0
 public Transceiver(Func<TcpGateway> gatewayFactory, OutBuffer buffer)
 {
     _gatewayFactory = gatewayFactory;
     _buffer = buffer;
 }
Beispiel #4
0
 public AcknowledgeHandler(QueueStorage storage, OutBuffer outBuffer)
 {
     _storage = storage;
     _outBuffer = outBuffer;
     _spin = new SpinWait();
 }
Beispiel #5
0
 public CommitHandler(EventStorageWriter writer, OutBuffer outBuffer)
 {
     _writer = writer;
     _outBuffer = outBuffer;
 }
 public LoadEventsByStreamHandler(EventStorageReader storage, OutBuffer buffer)
 {
     _storage = storage;
     _buffer = buffer;
     _spin = new SpinWait();
 }
Beispiel #7
0
 public SubscribeHandler(QueueStorage storage, OutBuffer outBuffer)
 {
     _storage = storage;
     _outBuffer = outBuffer;
     _spin = new SpinWait();
 }