[rabbitmq-discuss] RabbitMQ JavaAPI Queueing Consumer

Abhishek Kona abhishek.kona at gmail.com
Mon Jan 10 16:10:52 GMT 2011


Hi

I have had a look at the Queuing Consumer example given at 
http://www.rabbitmq.com/api-guide.html

*boolean*  autoAck =*false*;
QueueingConsumer consumer =*new*  QueueingConsumer(channel);
channel.basicConsume(queueName, autoAck, consumer);
*while*  (//* decide whether to continue reading *//) {
     QueueingConsumer.Delivery delivery;
     *try*  {
         delivery = consumer.nextDelivery();

	
     }*catch*  (InterruptedException ie) {
         *continue*;
     }
     ///MY APPLICATION CODE
/     channel.basicAck(delivery.getEnvelope().getDeliveryTag(),*false*);
}


I want to pass the message to a Separate Java Runnable Class (I am using 
Java ThreadPool Executors).
So I want to know how can the separate thread acknowledge the message.
I believe the message gets re-enqueued once the channel is closed.

Also how can I handle channel closing down or going stale (due to 
reasons like network outage)   in the above scenario.

-Abhishek Kona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110110/8c7fa26a/attachment.htm>


More information about the rabbitmq-discuss mailing list