[rabbitmq-discuss] RabbitMQ Consumer timeout

antony antony.pulicken at gmail.com
Tue Jun 25 12:56:53 BST 2013


This is my scenario:

I have multiple instances of listeners waiting on different temp queues. In
some of the cases, there won't be any messages published to these temp
queues and I want these listeners to timeout so that it can free up the

I guess in Java, we can achieve this by using the overloaded method in the
QueueingConsumer class that takes timeout as a parameter as shown below:

/QueueingConsumer.Delivery delivery = null;
long timeout = 2 * 60 * 1000; // 2 minutes in milliseconds
delivery = queuingConsumer.nextDelivery(*timeout*);
if (delivery == null) {
  // shut down your consumer here - no events arrived
  // before the timeout was reached
else {
  // process the delivered message here

1) Does RabbitMQ C client also has a similar feature ? 

2) Are there better approaches to handle this timeouts ?

Please let me know.

Thanks and Regards,

View this message in context: http://rabbitmq.1065348.n5.nabble.com/RabbitMQ-Consumer-timeout-tp27590.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list