示例#1
0
        /// <summary>
        ///   Инициализирует экземпляр класса ссылками на <see cref="IMessageAdapterFactory" />,
        ///   <see cref="IHealthCheckingService" />,
        ///   коллекции элементов <see cref="IProcessor" /> и <see cref="IProcessorAsync" />
        /// </summary>
        /// <param name="messageAdapterFactory"></param>
        /// <param name="messageProcessors"></param>
        /// <param name="asyncMessageProcessors"></param>
        /// <param name="healthCheckingService"></param>
        public QueueReactorFactory(
            IMessageAdapterFactory messageAdapterFactory, IEnumerable <IProcessor> messageProcessors,
            IEnumerable <IProcessorAsync> asyncMessageProcessors, IHealthCheckingService healthCheckingService,
            IMessagingCallContextAccessor messagingCallContextAccessor)
        {
            _messageAdapterFactory        = messageAdapterFactory.ThrowIfNull(nameof(messageAdapterFactory));
            _processors                   = messageProcessors.ThrowIfNull(nameof(messageProcessors));
            _asyncProcessors              = asyncMessageProcessors.ThrowIfNull(nameof(asyncMessageProcessors));
            _healthCheckingService        = healthCheckingService.ThrowIfNull(nameof(healthCheckingService));
            _messagingCallContextAccessor = messagingCallContextAccessor.ThrowIfNull(nameof(messagingCallContextAccessor));

            LogProcessors(_processors.ToList(), _asyncProcessors.ToList());
        }
示例#2
0
        /// <summary>
        ///   Базовый класс для реактора, работающего на основе шаблона "Наблюдатель"
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        protected QueueSubscribedReactorBase(
            IMessageAdapterWithSubscribing messageAdapter, int reconnectTimeout, string pollingId, bool?serviceHealthDependent,
            IHealthCheckingService healthCheckingService, IMessagingCallContextAccessor messagingCallContextAccessor)
        {
            adapter = messageAdapter.ThrowIfNull(nameof(messageAdapter));
            _messagingCallContextAccessor = messagingCallContextAccessor.ThrowIfNull(nameof(messagingCallContextAccessor));
            _healthCheckingService        = healthCheckingService.ThrowIfNull(nameof(serviceHealthDependent));
            if (reconnectTimeout <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(reconnectTimeout));
            }

            _hasDiagnosticErrors    = false;
            _serviceHealthDependent = serviceHealthDependent ?? false;

            _reconnectPolling = new Polling(reconnectTimeout, pollingId);
        }