I found this gem:
In the event of a connection failure, the client will need to establish a new connection to the broker. Any channels opened on the previous connection will have been automatically closed and these will need re-opening too.
So that's not good. I'm about to go write a big layer of handling automatic reconnects and recreating the channels then encapsulate this happening from all of my code. Problem is, this should be done already. Is this possible in the Java RMQ libraries?
Perhaps this is a new feature of the RabbitMQ client, but I found this in their docs:
To enable automatic connection recovery, use factory.setAutomaticRecoveryEnabled(true):
https://www.rabbitmq.com/api-guide.html
Looks like it should solve the problem.
Check out Lyra: A high availability RabbitMQ client that automatically recovers resources (connections/channels/consumers) when they're closed unexpectedly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With