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 } }
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"); } }