Ejemplo n.º 1
0
 public BrokeredMessageDispatcher(IRouteBrokeredMessages messageRouter,
                                  IBrokeredMessageDetailProvider brokeredMessageDetailProvider,
                                  IBodyConverterFactory bodyConverterFactory)
 {
     _messageRouter = messageRouter ?? throw new ArgumentNullException(nameof(messageRouter));
     _brokeredMessageDetailProvider = brokeredMessageDetailProvider ?? throw new ArgumentNullException(nameof(brokeredMessageDetailProvider));
     _bodyConverterFactory          = bodyConverterFactory ?? throw new ArgumentNullException(nameof(bodyConverterFactory));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a brokered message receiver that receives messages of <typeparamref name="TMessage"/>
 /// </summary>
 /// <param name="infrastructureReceiver">The message broker infrastructure</param>
 /// <param name="brokeredMessageDetailProvider">Provides routing details to the brokered message receiver</param>
 /// <param name="messageDispatcher">Dispatches messages of <typeparamref name="TMessage"/> to the appropriate <see cref="IMessageHandler{TMessage}"/></param>
 /// <param name="logger">Provides logging capability</param>
 public BrokeredMessageReceiver(IMessagingInfrastructureReceiver <TMessage> infrastructureReceiver,
                                IBrokeredMessageDetailProvider brokeredMessageDetailProvider,
                                IBrokeredMessageDispatcher brokeredMessageDispatcher,
                                ILogger <BrokeredMessageReceiver <TMessage> > logger,
                                IServiceScopeFactory serviceFactory)
 {
     _syncLock = new object();
     _infrastructureReceiver        = infrastructureReceiver ?? throw new ArgumentNullException(nameof(infrastructureReceiver));
     _brokeredMessageDetailProvider = brokeredMessageDetailProvider ?? throw new ArgumentNullException(nameof(brokeredMessageDetailProvider));
     _brokeredMessageDispatcher     = brokeredMessageDispatcher ?? throw new ArgumentNullException(nameof(brokeredMessageDispatcher));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     _serviceFactory = serviceFactory ?? throw new ArgumentNullException(nameof(serviceFactory));
 }
Ejemplo n.º 3
0
        public ServiceBusReceiver(ServiceBusOptions serviceBusConfiguration,
                                  IBrokeredMessageDetailProvider brokeredMessageDetailProvider,
                                  ILogger <ServiceBusReceiver <TMessage> > logger,
                                  IBodyConverterFactory bodyConverterFactory)
        {
            if (serviceBusConfiguration is null)
            {
                throw new ArgumentNullException(nameof(serviceBusConfiguration));
            }

            _syncLock                      = new object();
            ServiceBusConnection           = new ServiceBusConnection(serviceBusConfiguration.ConnectionString, serviceBusConfiguration.Policy);
            _brokeredMessageDetailProvider = brokeredMessageDetailProvider ?? throw new ArgumentNullException(nameof(brokeredMessageDetailProvider));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
            _bodyConverterFactory = bodyConverterFactory ?? throw new ArgumentNullException(nameof(bodyConverterFactory));
            _maxConcurrentCalls   = serviceBusConfiguration.MaxConcurrentCalls;
        }