[rabbitmq-discuss] AMQP ack with multiple subscribers

majek04 majek04 at gmail.com
Thu Oct 15 11:15:03 BST 2009

On Thu, Oct 15, 2009 at 01:28, Colin Z <theczintheroc2007 at gmail.com> wrote:
> If I have a queue with multiple subscribers/consumers and it also requires
> acks for the messages, what is the resulting behavior?
> Will the queue round robin the messages out to the subscribers regardless of
> whether the messages have been ack'ed yet or not? Or will the first message
> basically stall the delivery of the other messages in the queue until the
> first message has been ack'ed?

By default, if you have two consumers that are reading from one
queue, they will receive exactly every second message. No matter
if the messages were "light" or "heavy". For example, if queue looks like:
[light, heavy, light, heavy, light, heavy]
The first consumer will get all the "light" messages, and the second
one will get all the "heavy" ones. No matter when they will be acknowledged.
See this code:

Basic.qos is used to fight this limitation. Using it you can specify
how many messages are allowed to be unacknowledged for a channel.
Here you can see how to use it:

  Marek Majkowski

More information about the rabbitmq-discuss mailing list