Closed yan-oreshchenkov closed 5 years ago
If I shutdown the docker container, the service writes the following into the log:
Application is shutting down...
info: Rebus.Bus.RebusBus[0]
Setting number of workers to 0
which means the process is alive, but rebus listener is not some way.
Which version of the RabbitMQ driver does your application use?
Rebus uses the RabbitMQ driver with automatic recovery enabled, so in theory the driver should recover on its own, when the connection has been lost.
If that happens in some of your endpoints, is that because they're using a newer version of driver, maybe?
If I understand correctly, its 5.0.1:
All micro-services has the same codebase, so the driver is certainly the same.
yeah, that's 5.0.1 😄 can you figure out which version your other endpoints are using?
It's the same everywhere: 5.0.1, I've checked it twice. I explicitly upgraded it to 5.1.0, maybe it's a bug of the driver. I'll let you know about the results, but it takes a time to wait the next network 'storm'.
Great, thanks 🙂 I hope it's a bug in the driver 🤞
Nothing has happened yet :) But while the waiting for a network storm, we have added a simple health check endpoint to our services (based on .net core 2.2 embedded mechanism). It's very easy to extend with custom logic and it comes to my mind that it would be great if we could check the queue connectivity someway as a part of the healthcheck procedure. Could you advise a way to do it? Having something like a "current connection status for the queue" would be the great option.
Rebus provides a customizer callback in the RabbitMQ configuration extensions, with which you get to modify (or completely replace!) the IConnectionFactory
used by the transport.
It's used like this:
Configure.With(...)
.Transport(t => t.UseRabbitMq(..., customizer: connectionFactory => {
// maybe do something in here?
return connectionFactory;
}))
.(...)
.Start();
Maybe you can use that to hook something up that checks the connectivity...?
Btw. I just realized that Rebus' RabbitMQ transport underwent quite a few changes recently... it's been out as a prerelase for a while now, but I've just released Rebus.RabbitMq 5.0.0, so you should probably use that.
Hi there! We noticed some unreliable behavior of rebus in case of network issues, please advise.
info: Rebus.RabbitMq.ConnectionManager[0] Existing connection found to be CLOSED
warn: Rebus.RabbitMq.ConnectionManager[0] Could not establish connection: None of the specified endpoints were reachable
warn: Rebus.RabbitMq.RabbitMqTransport[0] Could not initialize consumer: RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---> System.TimeoutException: The operation has timed out. at RabbitMQ.Client.Impl.TaskExtensions.TimeoutAfter(Task task, Int32 millisecondsTimeout) at RabbitMQ.Client.Impl.SocketFrameHandler.ConnectOrFail(ITcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout) --- End of inner exception stack trace --- at RabbitMQ.Client.EndpointResolverExtensions.SelectOne[T](IEndpointResolver resolver, Func`2 selector) at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints) at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) --- End of inner exception stack trace --- at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) at Rebus.RabbitMq.ConnectionManager.GetConnection() at Rebus.RabbitMq.RabbitMqTransport.InitializeConsumer() at Rebus.RabbitMq.RabbitMqTransport.EnsureConsumerInitialized() - waiting 2 seconds
info: Rebus.RabbitMq.ConnectionManager[0] Existing connection found to be CLOSED
Could you please advice what we can try to do?