[rabbitmq-discuss] BasicQoS usage: consuming 1 by 1 messages avoind unacking the whole queue

Matthias Radestock matthias at rabbitmq.com
Thu Apr 21 10:45:53 BST 2011


Alfonso,

On 20/04/11 08:50, Alfonso Pantoja wrote:
> Regarding basic.qos...
>
> Having prefetchCount=1 what happens if 2 consumers consume from the
> same queue?

basic.qos is a channel setting, so the quota set that way is shared by 
all consumers on that channel.

> Consider this scenario:
>
> *3 messages on the queue Q1: M2, M1
> *2 consumers consuming from Q1: C1, C2
> *Consumers connected using basic.qos(prefetchSize=0, prefetchCount=1,
> global=false)
>
> 1. Is it possible to achieve this behavior? "C1 gets M1 and  C2 does
> not get message M2  until C1 acks or rejects M1" (some kind of
> blocking the queue until messages are acked or rejected)

That can only happen if C1 and C2 are on the same channel.

> setting QoS means that acks or rejects are mandatory?

Unless consuming in noack mode, generally consumers are expected to 
(eventually) ack or reject messages they have received.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list