[rabbitmq-discuss] Best way to subscribe-unsubscribe-subscribe

Michael Klishin mklishin at gopivotal.com
Thu Aug 22 10:01:30 BST 2013


Valentin Polezhaev:

> For example I have 2 queues ("A", "B") with 2 messages in each and I consume in A-B-A-B order.
> My code successfully reads first messages from both A and B queues, but third time (second read from A) it stays at line
> var ea = (BasicDeliverEventArgs) _basicConsumer.Queue.Dequeue();
> and nothing happens.
> 
> Moreover it'is strange that via control panel I can see 2 unacked messages in both A and B queues. Corresponding to program beheaviour I can understand unacked message in A queue but not in B - second consuming from B was not started yet.

RabbitMQ will push up to N messages at a time on a channel, which is controlled
using BasicQos. QueueingConsumer then stores them in a linked queue in memory.

You need to set prefetch value to 1 using BasicQos, see
http://www.rabbitmq.com/tutorials/tutorial-two-java.html
--
MK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130822/5a5d521b/attachment.pgp>


More information about the rabbitmq-discuss mailing list