[rabbitmq-discuss] Re-subscribing to a queue in a cluster

Adam Brightwell abrightwell at LCE.com
Fri Oct 5 00:13:45 BST 2012

Hello All,

I have been banging my head up against this one for a little while now and
I was hoping that the group could help me wrap my head around the proper
"workflow" for re-subscribing to a mirrored-queue in when a node is "lost".
So, to better understand my scenario here is a line by line description:

1. Create a cluster of two nodes.  Let's call them Node A and Node B.

2. Create a mirrored-queue on Node A and set its "x-ha-policy" to "all" so
that it will be mirrored across to Node B.
3. Subscribe to the mirrored-queue on with a consumer through Node B.
4. Publish message on Node B. Validated consumer received message.
5. Publish message on Node A. Validated consumer received message.
6. "Lose" Node A. (either shutdown or kill to simulate catastrophic
7. The consumer's "handleCancel(consumerTag)" method is called.

This is where I realize I am suppose to handle the canceling of the
consumer.  I have tried the following in order to "re-subscribe" to the
mirrored-queue that is now owned by Node B since Node A is no longer in
the picture.

1. Create new consumer and call basicConsume on the original channel.
2. Close original channel, recreate channel and call basicConsume with the
new channel.
3. Close the original channel, close the original Connection.  Reconnect,
recreate channel, call basicConsume with the new channel.

Not one of these approaches works.  With each, I have published messages
to the mirrored-queue on Node B.  The messages are either not consumed OR
they will be consumed and unacknowledged.  In the latter case, they are
not being processed by my consumer or at least not making it to the
"handleDelivery()" method.

What am I missing?

Any help, guidance, pointers or words of wisdom from the community would
be greatly appreciated.


More information about the rabbitmq-discuss mailing list