[rabbitmq-discuss] How to achieve HA consumers?
Rosa, Andrea (HP Cloud Services)
andrea.rosa at hp.com
Tue Sep 4 09:53:56 BST 2012
Thanks for your replies (Francesco and Matthias).
Now it's clear so we need to start the "backup" consumer after the first one.
>From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-
>discuss-bounces at lists.rabbitmq.com] On Behalf Of Matthias Radestock
>Sent: 03 September 2012 10:43
>To: Discussions about RabbitMQ
>Subject: Re: [rabbitmq-discuss] How to achieve HA consumers?
>On 03/09/12 10:29, Francesco Mazzoli wrote:
>> That said, whoever wants to consume from the queue needs to consume
>> token queue first. In the case of the OP, the main consumer will
>> and the second right after it. This way, the second will be blocked
>> first consumer dies/quits and the token message will be requeued.
>In pseudo code, this is what each consumer looks like:
>token_consumer = channel.basic_consume(token_queue)
>main_consumer = channel.basic_consume(main_queue)
> msg = wait_for_consumer_msg(main_consumer)
>There is one snag with this: When a consumer dies, the order in which
>the token message and any pending "proper" messages are requeued is
>undefined. That means the consumer that is taking over might start
>consuming from the main queue before the unack'ed messages have been
>requeued. The messages will get requeued eventually, but they will be
>out of order.
>In practice, introducing a slight delay before consuming from the main
>queue should prevent this.
>rabbitmq-discuss mailing list
>rabbitmq-discuss at lists.rabbitmq.com
More information about the rabbitmq-discuss