[rabbitmq-discuss] How to achieve HA consumers?

Matthias Radestock matthias at rabbitmq.com
Wed Sep 5 15:14:17 BST 2012


Johnson,

On 05/09/12 14:51, johnson wrote:
> The message-count is correct but the consumer-count is changed from 1
> to 0. I don't know why.

That is due to a subtlety in the meaning of consumer-count in the AMQP 
spec. From 
http://www.rabbitmq.com/amqp-0-9-1-reference.html#queue.declare-ok.consumer-count
<quote>
Reports the number of *active* consumers for the queue.
</quote>

Rabbit's interpretation of "active consumer" is "a consumer to which a 
message can be sent". Since your consumer channels have a qos prefetch 
count of 1, once a message has been sent to a consumer no further 
messages can be sent to it until it acks the message. Until then the 
consumer is inactive and hence won't be included in the consumer-count 
returned by queue.declare-ok.

The RabbitMQ management API/UI isn't bound by AMQP semantics, so it 
always reports all consumers, active or not.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list