Ejemplo n.º 1
0
 public static RabbitMqConnection GetInstance(IOptionsMonitor <RabbitMqConfig> options, ILogger <dynamic> logger)
 {
     if (_uniqueInstance == null || _uniqueInstance.Connection == null || _uniqueInstance.Connection.IsOpen == false)
     {
         lock (_lockObject)
         {
             if (_uniqueInstance == null || _uniqueInstance.Connection == null || _uniqueInstance.Connection.IsOpen == false)
             {
                 _uniqueInstance = new RabbitMqConnection(options.CurrentValue, logger);
             }
         }
     }
     return(_uniqueInstance);
 }
Ejemplo n.º 2
0
 public BaseRabbitMqConsumer(IOptionsSnapshot <RabbitMqConfig> options, ILogger <dynamic> logger)
 {
     _connection = RabbitMqConnection.GetInstance(options, logger).Connection;
     _channel    = _connection.CreateModel();
     _logger     = logger;
 }
Ejemplo n.º 3
0
 public RabbitMqProducer(IOptionsSnapshot <RabbitMqConfig> options, ILogger <RabbitMqProducer> logger)
 {
     _logger  = logger;
     _channel = RabbitMqConnection.GetInstance(options, logger).Connection.CreateModel();
 }
Ejemplo n.º 4
0
 protected BaseRabbitMqConsumer(IOptionsMonitor <RabbitMqConfig> options, ILogger <dynamic> logger)
 {
     _connection = RabbitMqConnection.GetInstance(options, logger).Connection;
     _channel    = _connection.CreateModel();
     _logger     = logger;
 }