[rabbitmq-discuss] consumer.Queue.Dequeue() timeout if there are no messages

Michael Klishin mklishin at gopivotal.com
Wed Apr 9 21:00:29 BST 2014


 On 9 April 2014 at 23:40:47, anate (ambatinr at hotmail.com) wrote:
> > I would like to come
> out from the program if there are no messages. How to handle this  
> scenario?

You get a timeout when there are no messages to deliver immediately.
Presumably that’s what you want and you should terminate your program
in such case, but RabbitMQ consumers are typically long running
and are not started periodically.

N.B. there is a SharedQueue#Dequeue version which accepts the timeout you want.
--  
MK  

Software Engineer, Pivotal/RabbitMQ


More information about the rabbitmq-discuss mailing list