Наследование: IMessageSessionAsyncHandlerFactory
Пример #1
0
        public override async Task Start()
        {
            IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(_context, this, DeliveryTracker, _messageReceiver);

            await _context.RegisterSessionHandlerFactoryAsync(handlerFactory, ExceptionHandler).ConfigureAwait(false);

            SetReady();
        }
Пример #2
0
        public async Task Start(NamespaceContext context)
        {
            var options = new SessionHandlerOptions
            {
                AutoComplete          = false,
                AutoRenewTimeout      = _clientSettings.AutoRenewTimeout,
                MaxConcurrentSessions = _clientSettings.MaxConcurrentCalls,
                MessageWaitTimeout    = _clientSettings.MessageWaitTimeout
            };

            options.ExceptionReceived += (sender, x) =>
            {
                if (!(x.Exception is OperationCanceledException))
                {
                    if (_log.IsErrorEnabled)
                    {
                        _log.Error($"Exception received on session receiver: {_clientContext.InputAddress} during {x.Action}", x.Exception);
                    }
                }

                if (_tracker.ActiveDeliveryCount == 0)
                {
                    if (_log.IsDebugEnabled)
                    {
                        _log.DebugFormat("Session receiver shutdown completed: {0}", _clientContext.InputAddress);
                    }

                    _participant.SetComplete();
                }
            };

            IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(context, _supervisor, this, _tracker, _topology);

            await _clientContext.RegisterSessionHandlerFactoryAsync(handlerFactory, options).ConfigureAwait(false);

            _participant.SetReady();
        }
Пример #3
0
        public async Task Start(NamespaceContext context)
        {
            var options = new SessionHandlerOptions
            {
                AutoComplete = false,
                AutoRenewTimeout = _clientSettings.AutoRenewTimeout,
                MaxConcurrentSessions = _clientSettings.MaxConcurrentCalls,
                MessageWaitTimeout = _clientSettings.MessageWaitTimeout
            };

            options.ExceptionReceived += (sender, x) =>
            {
                if (!(x.Exception is OperationCanceledException))
                {
                    if (_log.IsErrorEnabled)
                        _log.Error($"Exception received on session receiver: {_clientContext.InputAddress} during {x.Action}", x.Exception);
                }

                if (_tracker.ActiveDeliveryCount == 0)
                {
                    if (_log.IsDebugEnabled)
                        _log.DebugFormat("Session receiver shutdown completed: {0}", _clientContext.InputAddress);

                    _participant.SetComplete();
                }
            };

            IMessageSessionAsyncHandlerFactory handlerFactory = new MessageSessionAsyncHandlerFactory(context, _supervisor, this, _tracker, _sendEndpointProvider, _publishEndpointProvider);

            await _clientContext.RegisterSessionHandlerFactoryAsync(handlerFactory, options).ConfigureAwait(false);

            _participant.SetReady();
        }