[rabbitmq-discuss] Reconnect to RabbitMQ broker
Matthew Ward
matt.c.ward at gmail.com
Thu Mar 15 02:52:39 GMT 2012
To Give a few code examples, (I have omitted the non-relevant parts):
try {
this.consumer.nextDelivery();
} catch (ShutdownSignalException e) {
log.error("ShutdownSignalException", e);
if (this.channel.isOpen()) {
try {
this.channel.close();
} catch (AlreadyClosedException e1) {}
}
if (this.connection.isOpen()) {
try {
this.connection.close();
} catch (AlreadyClosedException e1) {}
}
this.connection = factory.newConnection();
this.channel.basicRecover();
I've got some logic in there to back off during connection refused, but its
when the server comes back online that I can't get rid of the
ShutDownSignalExceptions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120314/87f07b67/attachment.htm>
More information about the rabbitmq-discuss
mailing list