Spring AMQP Stale Consumers for RabbitMQ on PCF2019 Community Moderator ElectionActiveMQ or RabbitMQ or ZeroMQ orRabbitMQ consumer losing connectionSimpleMessageListenerContainer: Consumer raised exception, processing can restart if processing supports itRabbitMQ connection autorecovering after network failsSpring Amqp: Mix SimpleRoutingConnectionFactory with @RabbitListenerSpring boot Rabbitmq configuration for a remote queuerabbitmq docker spring o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s)Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method:RabbitMQ Multiple Consumers with Single connection ObjectReactor rabbitmq AlreadyClosedException

How to deal with a cynical class?

Russian cases: A few examples, I'm really confused

Sword in the Stone story where the sword was held in place by electromagnets

Who is our nearest planetary neighbor, on average?

Dot in front of file

How do I interpret this "sky cover" chart?

Does the statement `int val = (++i > ++j) ? ++i : ++j;` invoke undefined behavior?

Why doesn't the EU now just force the UK to choose between referendum and no-deal?

Brexit - No Deal Rejection

My adviser wants to be the first author

Rules about breaking the rules. How do I do it well?

Define, (actually define) the "stability" and "energy" of a compound

Happy pi day, everyone!

Calculus II Professor will not accept my correct integral evaluation that uses a different method, should I bring this up further?

Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab

Theorems like the Lovász Local Lemma?

Making a sword in the stone, in a medieval world without magic

Why did it take so long to abandon sail after steamships were demonstrated?

Is a lawful good "antagonist" effective?

Distribution of Maximum Likelihood Estimator

Ban on all campaign finance?

How do anti-virus programs start at Windows boot?

It's a yearly task, alright

What has been your most complicated TikZ drawing?



Spring AMQP Stale Consumers for RabbitMQ on PCF



2019 Community Moderator ElectionActiveMQ or RabbitMQ or ZeroMQ orRabbitMQ consumer losing connectionSimpleMessageListenerContainer: Consumer raised exception, processing can restart if processing supports itRabbitMQ connection autorecovering after network failsSpring Amqp: Mix SimpleRoutingConnectionFactory with @RabbitListenerSpring boot Rabbitmq configuration for a remote queuerabbitmq docker spring o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s)Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method:RabbitMQ Multiple Consumers with Single connection ObjectReactor rabbitmq AlreadyClosedException










0















Our team has been having some issues with Spring AMQP using cloud foundry connectors. Whenever there is some instability on network, the connection fails, then AMQP seems to try to auto-recover, fails to auto-recover, then creates a new consumer.



The problem is that the RabbitMQ doesn't seem to unregister the old consumers... so we end up having 40 consumers instead of just usual one consumer. And, I think, that because of the amount of invalid consumers, the old consumers receive some messages, but won't run our code. So we have a bunch of unacked messages until application is restarted and clear consumer list.



I'm not sure if this is a misconfiguration from our end, or a bug. Any ideas?



Additional information below.



A fraction of our logs:



a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-Dqik8vz9dSPiUzMbM4uGbw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-t7_vY47weZNYtWagl__pYA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-AK1YOpN0_E2KVwSi4fzOaw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.822 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-vrWhRdhk3ejrXo2-ImjXzA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:244) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 ... 7 common frames omitted
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:673) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]


We register our consumers using @RabbitListener annotation



 @RabbitListener(id = CONSUMER_ID, queues = "$CommonInternalEndPoint", containerFactory = "rabbitLocalContainerFactory")
protected void process(Object messageObject) {


As we do connect to multiple rabbit mq instances, we need to declare the connection factory manually. Our connection factory comes from cloud foundry connectors:



@Configuration
@Profile("cloud")
public class RabbitCloudConfiguration

@Bean
public Cloud cloud()
return new CloudFactory().getCloud();


@Bean
@Primary
public ConnectionFactory connectionFactory()
return cloud().getSingletonServiceConnector(ConnectionFactory.class, null);


@Bean("rabbitLocalContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitLocalContainerFactory()
SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
containerFactory.setConnectionFactory(connectionFactory());
containerFactory.setAutoStartup(true);
return containerFactory;











share|improve this question
























  • What Spring AMQP version do you use?

    – Artem Bilan
    Mar 6 at 19:21











  • We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

    – gabriel
    Mar 7 at 17:17















0















Our team has been having some issues with Spring AMQP using cloud foundry connectors. Whenever there is some instability on network, the connection fails, then AMQP seems to try to auto-recover, fails to auto-recover, then creates a new consumer.



The problem is that the RabbitMQ doesn't seem to unregister the old consumers... so we end up having 40 consumers instead of just usual one consumer. And, I think, that because of the amount of invalid consumers, the old consumers receive some messages, but won't run our code. So we have a bunch of unacked messages until application is restarted and clear consumer list.



I'm not sure if this is a misconfiguration from our end, or a bug. Any ideas?



Additional information below.



A fraction of our logs:



a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-Dqik8vz9dSPiUzMbM4uGbw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-t7_vY47weZNYtWagl__pYA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-AK1YOpN0_E2KVwSi4fzOaw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.822 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-vrWhRdhk3ejrXo2-ImjXzA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:244) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 ... 7 common frames omitted
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:673) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]


We register our consumers using @RabbitListener annotation



 @RabbitListener(id = CONSUMER_ID, queues = "$CommonInternalEndPoint", containerFactory = "rabbitLocalContainerFactory")
protected void process(Object messageObject) {


As we do connect to multiple rabbit mq instances, we need to declare the connection factory manually. Our connection factory comes from cloud foundry connectors:



@Configuration
@Profile("cloud")
public class RabbitCloudConfiguration

@Bean
public Cloud cloud()
return new CloudFactory().getCloud();


@Bean
@Primary
public ConnectionFactory connectionFactory()
return cloud().getSingletonServiceConnector(ConnectionFactory.class, null);


@Bean("rabbitLocalContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitLocalContainerFactory()
SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
containerFactory.setConnectionFactory(connectionFactory());
containerFactory.setAutoStartup(true);
return containerFactory;











share|improve this question
























  • What Spring AMQP version do you use?

    – Artem Bilan
    Mar 6 at 19:21











  • We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

    – gabriel
    Mar 7 at 17:17













0












0








0








Our team has been having some issues with Spring AMQP using cloud foundry connectors. Whenever there is some instability on network, the connection fails, then AMQP seems to try to auto-recover, fails to auto-recover, then creates a new consumer.



The problem is that the RabbitMQ doesn't seem to unregister the old consumers... so we end up having 40 consumers instead of just usual one consumer. And, I think, that because of the amount of invalid consumers, the old consumers receive some messages, but won't run our code. So we have a bunch of unacked messages until application is restarted and clear consumer list.



I'm not sure if this is a misconfiguration from our end, or a bug. Any ideas?



Additional information below.



A fraction of our logs:



a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-Dqik8vz9dSPiUzMbM4uGbw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-t7_vY47weZNYtWagl__pYA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-AK1YOpN0_E2KVwSi4fzOaw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.822 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-vrWhRdhk3ejrXo2-ImjXzA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:244) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 ... 7 common frames omitted
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:673) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]


We register our consumers using @RabbitListener annotation



 @RabbitListener(id = CONSUMER_ID, queues = "$CommonInternalEndPoint", containerFactory = "rabbitLocalContainerFactory")
protected void process(Object messageObject) {


As we do connect to multiple rabbit mq instances, we need to declare the connection factory manually. Our connection factory comes from cloud foundry connectors:



@Configuration
@Profile("cloud")
public class RabbitCloudConfiguration

@Bean
public Cloud cloud()
return new CloudFactory().getCloud();


@Bean
@Primary
public ConnectionFactory connectionFactory()
return cloud().getSingletonServiceConnector(ConnectionFactory.class, null);


@Bean("rabbitLocalContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitLocalContainerFactory()
SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
containerFactory.setConnectionFactory(connectionFactory());
containerFactory.setAutoStartup(true);
return containerFactory;











share|improve this question
















Our team has been having some issues with Spring AMQP using cloud foundry connectors. Whenever there is some instability on network, the connection fails, then AMQP seems to try to auto-recover, fails to auto-recover, then creates a new consumer.



The problem is that the RabbitMQ doesn't seem to unregister the old consumers... so we end up having 40 consumers instead of just usual one consumer. And, I think, that because of the amount of invalid consumers, the old consumers receive some messages, but won't run our code. So we have a bunch of unacked messages until application is restarted and clear consumer list.



I'm not sure if this is a misconfiguration from our end, or a bug. Any ideas?



Additional information below.



A fraction of our logs:



a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 com.rabbitmq.client.TopologyRecoveryException: Caught an exception while recovering consumer amq.ctag-Dqik8vz9dSPiUzMbM4uGbw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-t7_vY47weZNYtWagl__pYA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.823 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-AK1YOpN0_E2KVwSi4fzOaw: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 2019-03-04 00:31:47.822 ERROR [Atlas Backend,,,] 23 --- [0.32.27.77:5672] c.r.c.impl.ForgivingExceptionHandler : Caught an exception when recovering topology Caught an exception while recovering consumer amq.ctag-vrWhRdhk3ejrXo2-ImjXzA: connection is already closed due to connection error; cause: java.net.SocketException: Connection reset
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:244) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 ... 7 common frames omitted
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:577) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:657) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.doFinalShutdown(AMQConnection.java:687) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQConnection.notifyRecoveryCanBeginListeners(AMQConnection.java:693) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:198) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.RecordedConsumer.recover(RecordedConsumer.java:60) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConsumers(AutorecoveringConnection.java:673) [amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1242) ~[amqp-client-4.0.3.jar!/:4.0.3]
a0b279ba-fb73-41cc-bdf9-b430cec52856 1 Mon Mar 04 2019 02:31:47.842 at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]


We register our consumers using @RabbitListener annotation



 @RabbitListener(id = CONSUMER_ID, queues = "$CommonInternalEndPoint", containerFactory = "rabbitLocalContainerFactory")
protected void process(Object messageObject) {


As we do connect to multiple rabbit mq instances, we need to declare the connection factory manually. Our connection factory comes from cloud foundry connectors:



@Configuration
@Profile("cloud")
public class RabbitCloudConfiguration

@Bean
public Cloud cloud()
return new CloudFactory().getCloud();


@Bean
@Primary
public ConnectionFactory connectionFactory()
return cloud().getSingletonServiceConnector(ConnectionFactory.class, null);


@Bean("rabbitLocalContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitLocalContainerFactory()
SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
containerFactory.setConnectionFactory(connectionFactory());
containerFactory.setAutoStartup(true);
return containerFactory;








rabbitmq spring-amqp spring-cloud-connectors






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 19:19









Artem Bilan

67.2k84972




67.2k84972










asked Mar 6 at 19:00









gabrielgabriel

7017




7017












  • What Spring AMQP version do you use?

    – Artem Bilan
    Mar 6 at 19:21











  • We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

    – gabriel
    Mar 7 at 17:17

















  • What Spring AMQP version do you use?

    – Artem Bilan
    Mar 6 at 19:21











  • We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

    – gabriel
    Mar 7 at 17:17
















What Spring AMQP version do you use?

– Artem Bilan
Mar 6 at 19:21





What Spring AMQP version do you use?

– Artem Bilan
Mar 6 at 19:21













We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

– gabriel
Mar 7 at 17:17





We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3

– gabriel
Mar 7 at 17:17












1 Answer
1






active

oldest

votes


















0















We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3




Starting with version 2.0, Spring AMQP disables an automaticRecoveryEnabled on the target RabbitMQ ConnectionFactory: https://docs.spring.io/spring-amqp/docs/2.1.4.RELEASE/reference/#auto-recovery



Since the version you use is based on the RabbitMQ ConnectionFactory provided by the Cloud Connectors, you need to disable it explicitly:



@Bean
@Primary
public ConnectionFactory connectionFactory()
ConnectionFactory connectionFactory = cloud().getSingletonServiceConnector(ConnectionFactory.class, null);
((CachingConnectionFactory) connectionFactory).getRabbitConnectionFactory().setAutomaticRecoveryEnabled(false);
return connectionFactory;



And your solution is going to be based on the recovery mechanism provided by the Spring AMQP.






share|improve this answer























  • Thank you! I'll be testing this right away!

    – gabriel
    Mar 7 at 19:03











  • I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

    – gabriel
    Mar 7 at 19:14











  • As I said: it is disabled by default starting with Spring AMQP 2.0

    – Artem Bilan
    Mar 7 at 19:15










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030386%2fspring-amqp-stale-consumers-for-rabbitmq-on-pcf%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3




Starting with version 2.0, Spring AMQP disables an automaticRecoveryEnabled on the target RabbitMQ ConnectionFactory: https://docs.spring.io/spring-amqp/docs/2.1.4.RELEASE/reference/#auto-recovery



Since the version you use is based on the RabbitMQ ConnectionFactory provided by the Cloud Connectors, you need to disable it explicitly:



@Bean
@Primary
public ConnectionFactory connectionFactory()
ConnectionFactory connectionFactory = cloud().getSingletonServiceConnector(ConnectionFactory.class, null);
((CachingConnectionFactory) connectionFactory).getRabbitConnectionFactory().setAutomaticRecoveryEnabled(false);
return connectionFactory;



And your solution is going to be based on the recovery mechanism provided by the Spring AMQP.






share|improve this answer























  • Thank you! I'll be testing this right away!

    – gabriel
    Mar 7 at 19:03











  • I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

    – gabriel
    Mar 7 at 19:14











  • As I said: it is disabled by default starting with Spring AMQP 2.0

    – Artem Bilan
    Mar 7 at 19:15















0















We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3




Starting with version 2.0, Spring AMQP disables an automaticRecoveryEnabled on the target RabbitMQ ConnectionFactory: https://docs.spring.io/spring-amqp/docs/2.1.4.RELEASE/reference/#auto-recovery



Since the version you use is based on the RabbitMQ ConnectionFactory provided by the Cloud Connectors, you need to disable it explicitly:



@Bean
@Primary
public ConnectionFactory connectionFactory()
ConnectionFactory connectionFactory = cloud().getSingletonServiceConnector(ConnectionFactory.class, null);
((CachingConnectionFactory) connectionFactory).getRabbitConnectionFactory().setAutomaticRecoveryEnabled(false);
return connectionFactory;



And your solution is going to be based on the recovery mechanism provided by the Spring AMQP.






share|improve this answer























  • Thank you! I'll be testing this right away!

    – gabriel
    Mar 7 at 19:03











  • I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

    – gabriel
    Mar 7 at 19:14











  • As I said: it is disabled by default starting with Spring AMQP 2.0

    – Artem Bilan
    Mar 7 at 19:15













0












0








0








We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3




Starting with version 2.0, Spring AMQP disables an automaticRecoveryEnabled on the target RabbitMQ ConnectionFactory: https://docs.spring.io/spring-amqp/docs/2.1.4.RELEASE/reference/#auto-recovery



Since the version you use is based on the RabbitMQ ConnectionFactory provided by the Cloud Connectors, you need to disable it explicitly:



@Bean
@Primary
public ConnectionFactory connectionFactory()
ConnectionFactory connectionFactory = cloud().getSingletonServiceConnector(ConnectionFactory.class, null);
((CachingConnectionFactory) connectionFactory).getRabbitConnectionFactory().setAutomaticRecoveryEnabled(false);
return connectionFactory;



And your solution is going to be based on the recovery mechanism provided by the Spring AMQP.






share|improve this answer














We are using Spring Boot 1.5.9, Framework 4.3.6 , AMQP 1.7.4, RabbitMQ AMQP Client 4.0.3




Starting with version 2.0, Spring AMQP disables an automaticRecoveryEnabled on the target RabbitMQ ConnectionFactory: https://docs.spring.io/spring-amqp/docs/2.1.4.RELEASE/reference/#auto-recovery



Since the version you use is based on the RabbitMQ ConnectionFactory provided by the Cloud Connectors, you need to disable it explicitly:



@Bean
@Primary
public ConnectionFactory connectionFactory()
ConnectionFactory connectionFactory = cloud().getSingletonServiceConnector(ConnectionFactory.class, null);
((CachingConnectionFactory) connectionFactory).getRabbitConnectionFactory().setAutomaticRecoveryEnabled(false);
return connectionFactory;



And your solution is going to be based on the recovery mechanism provided by the Spring AMQP.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 17:24









Artem BilanArtem Bilan

67.2k84972




67.2k84972












  • Thank you! I'll be testing this right away!

    – gabriel
    Mar 7 at 19:03











  • I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

    – gabriel
    Mar 7 at 19:14











  • As I said: it is disabled by default starting with Spring AMQP 2.0

    – Artem Bilan
    Mar 7 at 19:15

















  • Thank you! I'll be testing this right away!

    – gabriel
    Mar 7 at 19:03











  • I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

    – gabriel
    Mar 7 at 19:14











  • As I said: it is disabled by default starting with Spring AMQP 2.0

    – Artem Bilan
    Mar 7 at 19:15
















Thank you! I'll be testing this right away!

– gabriel
Mar 7 at 19:03





Thank you! I'll be testing this right away!

– gabriel
Mar 7 at 19:03













I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

– gabriel
Mar 7 at 19:14





I was not sure if I should do this, because according to the documentation, both recoveries should "play along fine". But I see this is not the case, if they disabled in latest versions.

– gabriel
Mar 7 at 19:14













As I said: it is disabled by default starting with Spring AMQP 2.0

– Artem Bilan
Mar 7 at 19:15





As I said: it is disabled by default starting with Spring AMQP 2.0

– Artem Bilan
Mar 7 at 19:15



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55030386%2fspring-amqp-stale-consumers-for-rabbitmq-on-pcf%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко