Ejemplo n.º 1
0
        public ImparterTestService(IChannelFactory imparterChannels)
        {
            var commandHandler = new TestCommandHandler(imparterChannels);

            _incommingCommandsChannel = imparterChannels.GetSubscriberChannel("commands");
            _incommingCommandsChannel.Register <TestCommand>(commandHandler.Handle);
        }
Ejemplo n.º 2
0
        private void SubscribeToChannel(ISubscriberChannel <MessageEnvelope> channel,
                                        CancellationToken cancellationToken)
        {
            while (true)
            {
                var messageContext = channel.Receive();

                lock (this)
                    HandleMessageEnvelope(messageContext);

                if (cancellationToken.IsCancellationRequested)
                {
                    return;
                }
            }
        }
Ejemplo n.º 3
0
 public void AddSubscriberChannel(ISubscriberChannel <MessageEnvelope> subscriberChannel)
 {
     subscriberChannel.Require("subscriberChannel");
     subscriberChannels.Add(subscriberChannel);
 }