/// <summary> /// Starts the channel listener tasks. /// </summary> /// <param name="channel"></param> public void Start(IEstablishedReceiverChannel channel) { if (channel == null) { throw new ArgumentNullException(nameof(channel)); } lock (_syncRoot) { if (MessageListenerTask == null) { MessageListenerTask = CreateListenerTask( channel.ReceiveMessageAsync, _messageConsumer); } if (NotificationListenerTask == null) { NotificationListenerTask = CreateListenerTask( channel.ReceiveNotificationAsync, _notificationConsumer); } if (CommandListenerTask == null) { CommandListenerTask = CreateListenerTask( channel.ReceiveCommandAsync, _commandConsumer); } } }
public void Start(IEstablishedReceiverChannel channel) { lock (_syncRoot) { if (_cts != null && !_cts.IsCancellationRequested) { throw new InvalidOperationException("The listener is already active"); } _cts = new CancellationTokenSource(); MessageListenerTask = CreateListenerTask( channel.ReceiveMessageAsync, MessageBuffer, _messageConsumer, _cts.Token); NotificationListenerTask = CreateListenerTask( channel.ReceiveNotificationAsync, NotificationBuffer, _notificationConsumer, _cts.Token); CommandListenerTask = CreateListenerTask( channel.ReceiveCommandAsync, CommandBuffer, _commandConsumer, _cts.Token); } }
public void Start(IEstablishedReceiverChannel channel) { lock (_syncRoot) { if (_cts != null) { throw new InvalidOperationException("The listener is already started"); } _cts = new CancellationTokenSource(); _channelListener.Start(channel); } }
public void Start(IEstablishedReceiverChannel channel) { _channelListener.Start(channel); }
public void Start(IEstablishedReceiverChannel channel) { _channelListener.Start(channel); ReceiverChannel = channel; Started = true; }