public RabbitMqErrorHandlerConnection(IRabbitMqConnection connection, ILogger <RabbitMqPublisherConnection> logger) { _logger = logger; _connection = new Lazy <IConnection>(() => { _logger.LogWarning("Creating error handler RabbitMQ connection"); var physicalConnection = connection.Create(ConnectionType.Error); physicalConnection.CallbackException += OnPhysicalConnectionCallbackException; physicalConnection.ConnectionBlocked += OnPhysicalConnectionBlocked; physicalConnection.ConnectionShutdown += OnPhysicalConnectionShutdown; physicalConnection.ConnectionUnblocked += OnPhysicalConnectionUnblocked; return(physicalConnection); }); }