public DefaultRabbitMQPersistentConnection(IOptions <RabbitMQEventBusOptions> options, ILogger <DefaultRabbitMQPersistentConnection> logger)
 {
     _options           = options.Value;
     _connectionFactory = new ConnectionFactory
     {
         HostName               = _options.HostName,
         Port                   = _options.Port,
         UserName               = _options.UserName,
         Password               = _options.Password,
         VirtualHost            = _options.VirtualHost,
         DispatchConsumersAsync = true
     };
     _logger     = logger;
     _retryCount = _options.RetryCount;
 }
Ejemplo n.º 2
0
 public RabbitMQEventBus(IRabbitMQPersistentConnection persistentConnection, ILogger<RabbitMQEventBus> logger,
     IEventBusSubscriptionsManager subsManager, IOptions<RabbitMQEventBusOptions> options, 
     IServiceProvider serviceProvider)
 {
     _persistentConnection = persistentConnection ?? throw new ArgumentNullException(nameof(persistentConnection));
     _logger = logger;
     _subsManager = subsManager ?? throw new ArgumentNullException(nameof(subsManager));
     _options = options.Value;
     _exchangeName = _options.ExchangeName;
     _retryCount = _options.RetryCount;
     _prefetchCount = _options.PrefetchCount;
     _queueName = _options.QueueName;
     _consumerChannels = new Dictionary<string, IModel>();
     _serviceProvider = serviceProvider;
     _subsManager.OnEventRemoved += SubsManager_OnEventRemoved;
 }