Pritesh Patel
Pritesh Patel

Reputation: 39

Spring cloud bus(AMQP) not recreating queues after rabbitmq restarted

When using spring cloud bus with spring boot version 2.0.3, we are seeing following exceptions in the log

2019-08-07 14:12:56.049 ERROR 29 --- [X8-dnzvoAQ-2339] o.s.a.r.l.SimpleMessageListenerContainer :Consumer received fatal=false exception on startup
org.springframework.amqp.rabbit.listener.QueuesNotAvailableException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:620)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:996)
 at java.lang.Thread.run(Thread.java:748)
 Caused by: org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.gcUQP3LKQq6eX8-dnzvoAQ]

Based on google, we saw this JIRA ticket

https://github.com/spring-projects/spring-amqp/issues/818

Spring cloud bus should recreate this anonymous queue. Looks like this issue is fixed in latest version of spring AMQP based on this ticket

https://jira.spring.io/browse/AMQP-834

But my question is how can we fix this without upgrading this lib?

Upvotes: 0

Views: 1061

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

I believe that The only way to solve it without upgrading to a newer verdion is to set a policy on the broker:

enter image description here

Upvotes: 0

Related Questions