[rabbitmq-discuss] Reading messages using basicGet

Matthias Radestock matthias at rabbitmq.com
Mon Jul 18 11:12:56 BST 2011


On 15/07/11 20:18, Demi Zike wrote:
> I read the api-guide on your website at
> http://www.rabbitmq.com/api-guide.html. Retrieving individual messages
> using basicGet will get the job done but I am dealing with reading from
> multiple queues.
> I have a List of strings that store to which queues my app subscribed to
> read messages from.  How can I read through each of them until I find a
> message to return if there is one. And if I searched all the queues for
> available messages and didn't find any message sent to any of them then
> I want to return null.

basic.get returns basic.get-empty when the queue is empty. So simply 
iterate through the list of queues and do a basicGet on them until you 
find a message or reach the end.



More information about the rabbitmq-discuss mailing list