[rabbitmq-discuss] How to achieve HA consumers?

Francesco Mazzoli francesco at rabbitmq.com
Mon Sep 3 10:29:33 BST 2012

Hi Andrea,

At Mon, 3 Sep 2012 09:16:41 +0000,
Rosa, Andrea (HP Cloud Services) wrote:
> Sorry but I didn't understand your solution:
> >  * You create a second queue that we'll call "token queue", and you
> >publish one
> >    dummy message in it, with acks enabled.  Then, a consumer wishing to
> >consume
> >    from your queue, will:
> >
> >      - Consume from the token queue
> >      - Start consuming from the actual queue
> >      - When shutting down, publish a dummy message to the token queue
> Which consumer needs to consume from the "token queue"?
> When the second consumer will start to consume messages?

Please note that the last step is wrong (see Matthias correction).

That said, whoever wants to consume from the queue needs to consume from the
token queue first.  In the case of the OP, the main consumer will start first,
and the second right after it.  This way, the second will be blocked until the
first consumer dies/quits and the token message will be requeued.

I hope this makes it clearer for you.

Francesco * Often in error, never in doubt

More information about the rabbitmq-discuss mailing list