[rabbitmq-discuss] surviving a consumer disconnection using DefaultConsumer

rails stammailbox at gmail.com
Tue Apr 8 16:36:17 BST 2014

using java client QueueingConsumer I wrote the following code to assist
consumer recovery

while (true) {
      .. create connection
      .. create channel & queue
      while (true) {
             final QueueingConsumer.Delivery delivery = consumer.nextDelivery();
      } catch {

And every time I restarted rabbit it survived cause it created the
connection from start.
Now, I understand I should be working with DefaultConsumer.
So I have this method

public void handleDelivery(...) throws IOException {

and my problems are :

   1. I cant catch the exception inside and recreate the connection
   2. This only recovers when the ack fails. What if it fails in another
   stage of the process? How should I recover these fails?
   3. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140408/de67a5c0/attachment.html>

More information about the rabbitmq-discuss mailing list