[rabbitmq-discuss] Java client - com.rabbitmq.client.AlreadyClosedException and Shutdown event

Michael Klishin mklishin at gopivotal.com
Wed Sep 18 14:31:12 BST 2013


On sep 18, 2013, at 12:55 p.m., Francois-Guillaume Ribreau <ggapps at fgribreau.com> wrote:

> and now I got a lot of restarts. I'm not sure I clearly understood if I should do something when "shutdownCompleted" occurs (I never stopped RabbitMQ and RabbitMQ was always running when this happened), or if amqp-client can handle this by itself.

Unfortunately, shutdown events will be fired in both cases:

 * Unexpected shutdown (e.g. network goes down or RabbitMQ node dies)
 * Clean (application initiated) shutdown

ShutdownSignalException provides a number of methods to tell between various cases:

http://hg.rabbitmq.com/rabbitmq-java-client/file/0609500ae6bc/src/com/rabbitmq/client/ShutdownSignalException.java#l78

Hard errors generally cannot be recovered from. Soft errors are channel-level exceptions,
e.g. when you try to consume from a queue that does not exist.

You can also see the cause of shutdown signal, and if it's an I/O exception,
it's a good indicator that your app needs to reconnect (or even shut down and be restarted).

MK



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130918/ef0f4ae0/attachment.pgp>


More information about the rabbitmq-discuss mailing list