Java RabbitMQ client doesn't reconnect despite having automatic recovery enabled. We have a 3-node cluster. Queue is not in HA mode. When node managing the queue goes down for a restart, consumer connection isn't recovered after node becomes available again.
Here is the exception we get:
com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-CNP1joDPC-8gExVmVOi9uw: channel is already closed due to channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - home node 'rabbit@hostname' of durable queue 'queue-name' in vhost 'vhost-name' is down or inaccessible, class-id=50, method-id=10)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:717)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.beginAutomaticRecovery(AutorecoveringConnection.java:546)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:59)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection$2.recoveryCanBegin(AutorecoveringConnection.java:474)
at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:754)
at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:731)
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:615)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - home node 'rabbit@hostname' of durable queue 'queue-name' in vhost 'vhost-name' is down or inaccessible, class-id=50, method-id=10)
at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:228)
at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:303)
at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1261)
at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:698)
... 7 common frames omitted
and this is how we configure the connection:
ConnectionFactory factory = new ConnectionFactory(); factory.setHost(config.getHost()); factory.setPort(config.getPort()); factory.setUsername(config.getUser()); factory.setPassword(config.getPassword()); factory.setVirtualHost(config.getVHost()); factory.setAutomaticRecoveryEnabled(true); factory.setRequestedHeartbeat(10); factory.setExceptionHandler(new StrictExceptionHandler());
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--MKStaff Software Engineer, Pivotal/RabbitMQ
--
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/WcdJPIn7TWQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tomasz Adamski SOFTWARE ENGINEER
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--MKStaff Software Engineer, Pivotal/RabbitMQ
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/WcdJPIn7TWQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Tomasz Adamski SOFTWARE ENGINEER
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--MKStaff Software Engineer, Pivotal/RabbitMQ
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/WcdJPIn7TWQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Tomasz Adamski SOFTWARE ENGINEER
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitm...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--MKStaff Software Engineer, Pivotal/RabbitMQ
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/WcdJPIn7TWQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitm...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Tomasz Adamski SOFTWARE ENGINEER
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitm...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/18392746-cfe0-4d31-a4d1-140642491da3%40googlegroups.com.
sudo rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}'sudo systemctl stop rabbitmq-server
sudo systemctl start rabbitmq-server//create connection
factory.setAutomaticRecoveryEnabled(true);factory.setNetworkRecoveryInterval(5);factory.setTopologyRecoveryEnabled(true);To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/68a864ee-14a0-4d47-91f5-8a47060c3016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/68a864ee-14a0-4d47-91f5-8a47060c3016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/193359eb-3bee-429f-b108-960b5699ab15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Bean
public CachingConnectionFactory cachingConnectionFactory(ConnectionFactory connectionFactory) {
return new CachingConnectionFactory(connectionFactory);
}
@Bean
public CachingConnectionFactory cachingConnectionFactory(ConnectionFactory connectionFactory) {
CachingConnectionFactory cachingConnectionFactory =
new CachingConnectionFactory(connectionFactory);
cachingConnectionFactory.getRabbitConnectionFactory().setAutomaticRecoveryEnabled(true);
return cachingConnectionFactory;
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/193359eb-3bee-429f-b108-960b5699ab15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/062d5918-753f-4ed0-8090-3ac48a31506c%40googlegroups.com.