Repository: airavata Updated Branches: refs/heads/airavata-0.15-release-branch 58e3b4d40 -> 4133c5b04
rabbitmq auto reconnect and add shutdownlistener to channel Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/4133c5b0 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/4133c5b0 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/4133c5b0 Branch: refs/heads/airavata-0.15-release-branch Commit: 4133c5b04de63eb509c6ab3e8b4ee0b50d09f665 Parents: 58e3b4d Author: Chathuri Wimalasena <[email protected]> Authored: Wed Jun 10 09:37:22 2015 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Wed Jun 10 09:37:22 2015 -0400 ---------------------------------------------------------------------- .../messaging/core/impl/RabbitMQTaskLaunchConsumer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/4133c5b0/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchConsumer.java ---------------------------------------------------------------------- diff --git a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchConsumer.java b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchConsumer.java index 4aeb804..86ea669 100644 --- a/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchConsumer.java +++ b/modules/messaging/core/src/main/java/org/apache/airavata/messaging/core/impl/RabbitMQTaskLaunchConsumer.java @@ -82,16 +82,25 @@ public class RabbitMQTaskLaunchConsumer { ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setUri(url); connectionFactory.setAutomaticRecoveryEnabled(true); + connectionFactory.setRequestedHeartbeat(5); + connectionFactory.setConnectionTimeout(5000); + connectionFactory.setNetworkRecoveryInterval(100); connection = connectionFactory.newConnection(); connection.addShutdownListener(new ShutdownListener() { public void shutdownCompleted(ShutdownSignalException cause) { - log.info("RabbitMQ connection shutting down"); + log.error("**************** ######## RabbitMQ connection shutting down ********** #######"); } }); log.info("connected to rabbitmq: " + connection + " for " + taskLaunchExchangeName); channel = connection.createChannel(); channel.basicQos(prefetchCount); + channel.addShutdownListener(new ShutdownListener() { + @Override + public void shutdownCompleted(ShutdownSignalException e) { + log.error("************ ######### RabbitMQ channel shutting down ********** #######"); + } + }); // channel.exchangeDeclare(taskLaunchExchangeName, "fanout");
