[rabbitmq-discuss] Clients reconnection logic

Jerry Kuch jerryk at vmware.com
Tue Jan 31 19:41:20 GMT 2012

Hi, Pablo...

I confess I'm not up on the current state of the projects that you're looking
at, but the reconnect logic doesn't have to be much more exotic than catching
the connection failure and opening a new one (plus possibly recreating your
message fabric elements if appropriate) when it occurs.  Probably the most 
annoying part is making your client code aware of all the nodes in your cluster,
keeping track of those nodes that have spurned it in the past, and choosing other
ones to try (plus maybe re-trying a spurner at some point).

One thing you might consider to make that last part less annoying is putting
some sort of load balancer, like HAproxy, in front of your cluster.  Then it
can do the dirty work of making sure to wire your connection to a live cluster
node, and your clients only need to know one place to connect to...  Sure, it's
more of a deployment/infrastructural change, but it can make things simpler in

Best regards,

----- Original Message -----
From: "Pablo Molnar" <pablomolnar at gmail.com>
To: rabbitmq-discuss at lists.rabbitmq.com
Sent: Monday, January 30, 2012 1:01:36 PM
Subject: [rabbitmq-discuss] Clients reconnection logic

Hi everyone,
I've successfully set up a 3 instances cluster and now I'm dealing
with reconnect logic in my java clients.

Before reinventing the wheel, I'm aware of this 2 projects:
- https://github.com/joshdevins/rabbitmq-ha-client
- http://hg.rabbitmq.com/rabbitmq-java-messagepatterns/

Anyone have tried this code? Both seems a little outdated...

I'm just wanna the simplest logic giving a fixed list of nodes to
successfully reconnect my clients in a transparent manner.

I'd appreciate any info regarding clients reconnection.

Pablo Molnar
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com

More information about the rabbitmq-discuss mailing list