public ImparterTestService(IChannelFactory imparterChannels) { var commandHandler = new TestCommandHandler(imparterChannels); _incommingCommandsChannel = imparterChannels.GetSubscriberChannel("commands"); _incommingCommandsChannel.Register <TestCommand>(commandHandler.Handle); }
private void SubscribeToChannel(ISubscriberChannel <MessageEnvelope> channel, CancellationToken cancellationToken) { while (true) { var messageContext = channel.Receive(); lock (this) HandleMessageEnvelope(messageContext); if (cancellationToken.IsCancellationRequested) { return; } } }
public void AddSubscriberChannel(ISubscriberChannel <MessageEnvelope> subscriberChannel) { subscriberChannel.Require("subscriberChannel"); subscriberChannels.Add(subscriberChannel); }