[rabbitmq-discuss] asynchronous fetching messages from rabbitMQ queues

Matthew Sackman matthew at rabbitmq.com
Mon Oct 24 13:57:38 BST 2011


On Mon, Oct 24, 2011 at 04:51:35AM -0700, pavuuu wrote:
> Is it possible to fetch messages asynchronously from rabbitMQ queues ?

Yes. Basic.consume will deliver msgs asynchronously to the client.

> Colz when I do two consecutive BasicConsume's on any particular queue, I get
> the same message twice.

Please provide code that demonstrates this - this should not happen.
Multiple basic.consumes on the _same_ queue will make the queue deliver
each message to one consumer (in the absence of requeuings).

> If I have to fetch the first two messages, I have to do
> 
> BasicConsume -- BasicAck -- BasicConsume -- BasicAck

No.

BasicConsume -> BasicDeliver -> BasicAck -> BasicDeliver -> BasicAck ...

> Also, will the client library supports fetching, say top 100, messages of
> any particular queue. ?

Yes, you want want to use basic.qos and set the msg prefetch count to
100.

Matthew


More information about the rabbitmq-discuss mailing list