public MessageReceivePump(
            IMessageReceiver messageReceiver,
            MessageHandlerOptions registerHandlerOptions,
            Func <Message, CancellationToken, Task> callback,
            CancellationToken pumpCancellationToken)
        {
            if (messageReceiver == null)
            {
                throw new ArgumentNullException(nameof(messageReceiver));
            }

            this.messageReceiver                 = messageReceiver;
            this.registerHandlerOptions          = registerHandlerOptions;
            this.onMessageCallback               = callback;
            this.pumpCancellationToken           = pumpCancellationToken;
            this.maxConcurrentCallsSemaphoreSlim = new SemaphoreSlim(this.registerHandlerOptions.MaxConcurrentCalls);
        }
Пример #2
0
 /// <summary>Asynchronously processes a message.</summary>
 /// <param name="handler"></param>
 /// <param name="messageHandlerOptions">Options associated with message pump processing.</param>
 public void RegisterMessageHandler(Func <Message, CancellationToken, Task> handler, MessageHandlerOptions messageHandlerOptions)
 {
     this.InnerReceiver.RegisterMessageHandler(handler, messageHandlerOptions);
 }
Пример #3
0
 /// <summary>Asynchronously processes a message.</summary>
 /// <param name="handler"></param>
 /// <param name="registerHandlerOptions">Calls a message option.</param>
 public void RegisterMessageHandler(Func <Message, CancellationToken, Task> handler, MessageHandlerOptions registerHandlerOptions)
 {
     this.InnerSubscriptionClient.InnerReceiver.RegisterMessageHandler(handler, registerHandlerOptions);
 }