Spring 云总线 (AMQP) 在 rabbitmq 重启后没有重新创建队列
Spring cloud bus(AMQP) not recreating queues after rabbitmq restarted
当使用 spring 云总线和 spring 引导版本 2.0.3 时,我们在日志中看到以下异常
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]
基于google,我们看到了这张JIRA ticket
https://github.com/spring-projects/spring-amqp/issues/818
Spring 云总线应该重新创建这个匿名队列。看起来这个问题已在最新版本的 spring AMQP 中基于此票证
得到修复
https://jira.spring.io/browse/AMQP-834
但我的问题是我们如何在不升级这个库的情况下解决这个问题?
我认为在不升级到较新版本的情况下解决它的唯一方法是在代理上设置策略:
当使用 spring 云总线和 spring 引导版本 2.0.3 时,我们在日志中看到以下异常
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]
基于google,我们看到了这张JIRA ticket
https://github.com/spring-projects/spring-amqp/issues/818
Spring 云总线应该重新创建这个匿名队列。看起来这个问题已在最新版本的 spring AMQP 中基于此票证
得到修复https://jira.spring.io/browse/AMQP-834
但我的问题是我们如何在不升级这个库的情况下解决这个问题?
我认为在不升级到较新版本的情况下解决它的唯一方法是在代理上设置策略: