/// <summary> /// Initializes a new instance of the <see cref="DataflowChannelListener" /> class. /// </summary> /// <param name="messageTargetBlock">The message target block.</param> /// <param name="notificationTargetBlock">The notification target block.</param> /// <param name="commandTargetBlock">The command target block.</param> /// <exception cref="System.ArgumentNullException"> /// </exception> public DataflowChannelListener(ITargetBlock <Message> messageTargetBlock, ITargetBlock <Notification> notificationTargetBlock, ITargetBlock <Command> commandTargetBlock) { if (messageTargetBlock == null) { throw new ArgumentNullException(nameof(messageTargetBlock)); } if (notificationTargetBlock == null) { throw new ArgumentNullException(nameof(notificationTargetBlock)); } if (commandTargetBlock == null) { throw new ArgumentNullException(nameof(commandTargetBlock)); } _channelListener = new ChannelListener(messageTargetBlock.SendAsync, notificationTargetBlock.SendAsync, commandTargetBlock.SendAsync); }
/// <summary> /// Initializes a new instance of the <see cref="DataflowChannelListener" /> class. /// </summary> /// <param name="messageTargetBlock">The message target block.</param> /// <param name="notificationTargetBlock">The notification target block.</param> /// <param name="commandTargetBlock">The command target block.</param> /// <exception cref="System.ArgumentNullException"> /// </exception> public DataflowChannelListener(ITargetBlock <Message> messageTargetBlock, ITargetBlock <Notification> notificationTargetBlock, ITargetBlock <Command> commandTargetBlock) { if (messageTargetBlock == null) { throw new ArgumentNullException(nameof(messageTargetBlock)); } if (notificationTargetBlock == null) { throw new ArgumentNullException(nameof(notificationTargetBlock)); } if (commandTargetBlock == null) { throw new ArgumentNullException(nameof(commandTargetBlock)); } _channelListener = new ChannelListener( (Func <Message, CancellationToken, Task <bool> >)messageTargetBlock.SendAsync, (Func <Notification, CancellationToken, Task <bool> >)notificationTargetBlock.SendAsync, (Func <Command, CancellationToken, Task <bool> >)commandTargetBlock.SendAsync); }
/// <summary> /// Initializes a new instance of the <see cref="EventChannelListener"/> class. /// </summary> public EventChannelListener() { _channelListener = new ChannelListener(RaiseMessageReceivedAsync, RaiseNotificationReceivedAsync, RaiseCommandReceivedAsync); }