Using message consumer with connection setAutomaticRecoveryEnabled

729 views
Skip to first unread message

Eranda Rajapakshe

unread,
Feb 19, 2015, 6:18:49 AM2/19/15
to rabbitm...@googlegroups.com
Hi,
I am trying to implement a rabbitmq message consumer with automatic recovery enabled to recover from network failures. With all recovery and topology features enabled I was able to recover the connection ( with channels, queues, exchanges, binding etc... ) in to original condition after re-start. But now my consumer can not receive any messages. When a message come to the subscribed queue it shows following exception instead of retrieving the message.  

DefaultExceptionHandler: Consumer com.rabbitmq.client.QueueingConsumer@628fb58 (amq.ctag-dCcXsrM8SdDRDuI7QYU8Tw) method handleDelivery for channel AMQChannel(amqp://gu...@127.0.0.1:5672/,1) threw an exception for channel AMQChannel(amqp://gu...@127.0.0.1:5672/,1):
com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=320, reply-text=CONNECTION_FORCED - Closed via management plugin, class-id=0, method-id=0)
at com.rabbitmq.client.QueueingConsumer.checkShutdown(QueueingConsumer.java:172)
at com.rabbitmq.client.QueueingConsumer.handleDelivery(QueueingConsumer.java:124)
at com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:144)
at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:99)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


Please help.

Thank you!

Eranda Rajapakshe

unread,
Feb 19, 2015, 11:38:19 PM2/19/15
to rabbitm...@googlegroups.com
Since I have added automatic recovery on the connection, it recovers fine and channels gets opened after I restart the server. But when I try to consume the messages from the queue ShutdownSignalException keeps on coming even though the channel is opened. 

How can I recover from this? Do I have to handle the SSE signal? 

Please help! 

Thank you!


On Thursday, February 19, 2015 at 4:48:49 PM UTC+5:30, Eranda Rajapakshe wrote:
Hi,
I am trying to implement a rabbitmq message consumer with automatic recovery enabled to recover from network failures. With all recovery and topology features enabled I was able to recover the connection ( with channels, queues, exchanges, binding etc... ) in to original condition after re-start. But now my consumer can not receive any messages. When a message come to the subscribed queue it shows following exception instead of retrieving the message.  

DefaultExceptionHandler: Consumer com.rabbitmq.client.QueueingConsumer@628fb58 (amq.ctag-dCcXsrM8SdDRDuI7QYU8Tw) method handleDelivery for channel AMQChannel(amqp://guest@127.0.0.1:5672/,1) threw an exception for channel AMQChannel(amqp://guest@127.0.0.1:5672/,1):

com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=320, reply-text=CONNECTION_FORCED - Closed via management plugin, class-id=0, method-id=0)
at com.rabbitmq.client.QueueingConsumer.checkShutdown(QueueingConsumer.java:172)
at com.rabbitmq.client.QueueingConsumer.handleDelivery(QueueingConsumer.java:124)
at com.rabbitmq.client.impl.ConsumerDispatcher$5.run(ConsumerDispatcher.java:144)
at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:99)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


Please help.

Thank you!

Jean-Sébastien Pédron

unread,
Mar 17, 2015, 6:28:50 AM3/17/15
to rabbitm...@googlegroups.com
On 20.02.2015 05:38, Eranda Rajapakshe wrote:
> Since I have added automatic recovery on the connection, it recovers
> fine and channels gets opened after I restart the server. But when I try
> to consume the messages from the queue ShutdownSignalException keeps on
> coming even though the channel is opened.
>
> How can I recover from this? Do I have to handle the SSE signal?

Hi!

The error message indicates the connection was terminated from the
management web UI:
CONNECTION_FORCED - Closed via management plugin

It has nothing to do with automatic recovery AFAICT.

--
Jean-Sébastien Pédron
Pivotal / RabbitMQ

Michael Klishin

unread,
Mar 17, 2015, 6:32:59 AM3/17/15
to Jean-Sébastien Pédron, rabbitm...@googlegroups.com
On 17 March 2015 at 11:28:50, Jean-Sébastien Pédron (jean-se...@rabbitmq.com) wrote:
> The error message indicates the connection was terminated
> from the
> management web UI:
> CONNECTION_FORCED - Closed via management plugin
>
> It has nothing to do with automatic recovery AFAICT.

FTR, some clients (Bunny and March Hare) support recovering from server-sent connection.close.

This is an opt-in feature and we can pretty trivially add it to Java and .NET clients if there's enough
demand. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

eranda rajapaksha

unread,
Mar 19, 2015, 12:24:14 AM3/19/15
to Michael Klishin, Jean-Sébastien Pédron, rabbitm...@googlegroups.com
Thanks for the reply!

I used to UI to disconnect the client in order to test the automatic recovery feature. What I am trying to do is to implement a message consumer with auto-recovery. I used the previous method that I have mentioned ( by enabling automatic recovery and topology ) but it gave the "ShutdownSignalExcpetion" when trying to consume new messages after recovery. 

So what I have done now is, only use the automatic recovery feature ( not the topology recover ) and create the channels,exchanges, queues and binding manually and then create a consumer too. It works fine in that way. 

If there is a way to handle the "ShutdownSignalException" from the consumer and move forward to consume the messages, my work would have been more simpler. 

Any suggestions for that?

Thank you!



--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/jJzNhJPBMfM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send an email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Klishin

unread,
Mar 19, 2015, 2:44:36 AM3/19/15
to eranda rajapaksha, Jean-Sébastien Pédron, rabbitm...@googlegroups.com
Consumers do have a method for signal handling.

Are you implementing manual recovery? Then see what automatic recovery foes (the sequence of operations is listed in the docs).

MK
Reply all
Reply to author
Forward
0 new messages