简体   繁体   English

Rabbitmq重新启动后,Spring Cloud Bus(AMQP)无法重新创建队列

[英]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 在Spring Boot版本2.0.3中使用Spring Cloud Bus时,我们在日志中看到以下异常

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 基于Google,我们看到了这张JIRA门票

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

Spring cloud bus should recreate this anonymous queue. Spring Cloud Bus应该重新创建此匿名队列。 Looks like this issue is fixed in latest version of spring AMQP based on this ticket 看起来此问题已在基于此票证的最新版本的Spring AMQP中修复

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

But my question is how can we fix this without upgrading this lib? 但是我的问题是,如何在不升级此库的情况下解决此问题?

I believe that The only way to solve it without upgrading to a newer verdion is to set a policy on the broker: 我认为解决此问题而不升级到新版本的唯一方法是在经纪人上设置政策:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM