예제 #1
0
        private void EnsureConnectionToRabbitMq()
        {
            if (_channel is null || _channel.IsClosed)
            {
                _logger.LogInformation($"RabbitMq channel is not established. Trying to establish channel");

                _channel?.Close();
                _channel?.Dispose();
                _channel = null;

                _channel = _rabbitMqConnection.GetConnection().CreateModel();

                //TODO 2: CallbackException handle
            }
        }
예제 #2
0
        private void EnsureConnectionToRabbitMq()
        {
            if (_channel is null || _channel.IsClosed)
            {
                _logger.LogInformation($"RabbitMq channel is not established. Trying to establish channel");

                _channel?.Close();
                _channel?.Dispose();
                _channel = null;

                _channel = _rabbitMqConnection.GetConnection().CreateModel();
                _channel.CallbackException += OnChannelCallbackException;
                _channel.ModelShutdown     += OnModelShutdown;

                _logger.LogInformation($"RabbitMq channel is established");
            }
        }