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

Alfonso Pantoja alfonso.pantoja at gmail.com
Wed Apr 20 08:50:32 BST 2011


Hi,

On 8 abr, 17:09, Simon MacMullen <si... at rabbitmq.com> wrote:

>
> The difference is that basic.get will return immediately if there are no
> messages for you, whereas [basic.qos(prefetchCount=1), basic.consume]
> will wait for a message to become available. So if you use basic.get
> you'll have to keep polling. In general you probably want to use
> basic.consume.

Regarding basic.qos...

Having prefetchCount=1 what happens if 2 consumers consume from the
same queue?

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)
2. If 1 is possible, maybe 2 consumers should use the same channel
because global=false?
3. If 1 and 2 are correct setting QoS means that acks or rejects are
mandatory?


Thank you in advance,


Alfonso




More information about the rabbitmq-discuss mailing list