示例#1
0
 public void RegisterOnMessageHandlerStart(string clientId, RegisterHandlerOptions registerHandlerOptions)
 {
     if (this.IsEnabled())
     {
         this.RegisterOnMessageHandlerStart(clientId, registerHandlerOptions.AutoComplete, registerHandlerOptions.AutoRenewLock, registerHandlerOptions.MaxConcurrentCalls, (long)registerHandlerOptions.AutoRenewTimeout.TotalSeconds);
     }
 }
        public MessageReceivePump(
            MessageReceiver messageReceiver,
            RegisterHandlerOptions 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);
        }
 /// <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, RegisterHandlerOptions registerHandlerOptions)
 {
     this.InnerSubscriptionClient.InnerReceiver.RegisterMessageHandler(handler, registerHandlerOptions);
 }