/// <summary>
 ///   Инициализирует компонент ссылками на <see cref="IConfiguration" />,
 ///   <see cref="IMessageAdapterFactory" />,
 ///   коллекции элементов <see cref="IMessageSerializer" /> и <see cref="IMessageDeserializer" />>
 /// </summary>
 /// <param name="configuration">Провайдер конфигурации</param>
 /// <param name="adapterFactory">Фабрика адаптеров для очередей</param>
 /// <param name="serializers">Коллекция сериализаторов</param>
 /// <param name="deserializers">Коллекция десериализаторов</param>
 public MessagingComponentFactory(
     IConfiguration configuration, IMessageAdapterFactory adapterFactory, IReadOnlyCollection <IMessageSerializer> serializers,
     IReadOnlyCollection <IMessageDeserializer> deserializers, ICallContextFactory callContextFactory)
 {
     _adapterFactory     = adapterFactory.ThrowIfNull(nameof(adapterFactory));
     _serializers        = serializers.ThrowIfNull(nameof(serializers));
     _deserializers      = deserializers.ThrowIfNull(nameof(deserializers));
     _callContextFactory = callContextFactory.ThrowIfNull(nameof(callContextFactory));
     _connectionOptions  = configuration.ThrowIfNull(nameof(configuration))
                           .GetSection("messaging")
                           .Get <MessagingConfiguration>();
 }
Пример #2
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());
        }