[rabbitmq-discuss] How do you handle recovering from a faulty connection using RabbitMQ java client library?

Michael Klishin mklishin at gopivotal.com
Thu Oct 31 17:34:10 GMT 2013


On 31 Oct 2013, at 21:28, Peter Moberg <moberg.peter at gmail.com> wrote:

> Solution C)
> 
> Wrap Connection and Channel classes is classes that handle the re-connection logic, the consumer only needs to know about the WrappedChannel class. On a connection failure the WrappedConnection with deal with re-establishing the connection and once connected the WrappedConnection will automatically create new Channels and register consumers.
> 
> Pros: It work - this is actually the solution we are using today.
> 
> Cons: It feels like a hack, I think this is something that should be handled more elegantly by the underlying library.

This is what the two clients built on top of the Java one — Langohr and March Hare — do.
It’s not a hack but a necessary work around because connection recovery is currently
not performed by the Java client (it should be a core feature, if you ask me).

So this is a viable approach.

Take a look at Lyra, too: https://github.com/jhalterman/lyra.

MK

Software Engineer, Pivotal/RabbitMQ




More information about the rabbitmq-discuss mailing list