SpringBoot集成RbbitMQ队列踩坑记录
找不到队列
2019-07-03 13:11:11.106 WARN 11944 --- [cTaskExecutor-1] o.s.a.r.listener.BlockingQueueConsumer : Failed to declare queue: hello
2019-07-03 13:11:11.118 WARN 11944 --- [cTaskExecutor-1] o.s.a.r.listener.BlockingQueueConsumer : Queue declaration failed; retries left=3
org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[hello]
解决办法1
在页面客户端手动创建所需队列

解决办法2
使用代码自动创建
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 消息队列配置类,创建消息队列
* 路由秘钥为hello
*/
@Configuration
public class RbbitConfig {
@Bean
public Queue messageQueue(){
return new Queue("hello1");
}
}总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
IDEA Error:java: 无效的源发行版: 17错误
本文主要介绍了IDEA Error:java: 无效的源发行版: 17错误,这个错误是因为您的IDEA编译器不支持Java 17版本,您需要更新您的IDEA编译器或者将您的Java版本降级到IDEA支持的版本,本文就来详细的介绍一下2023-08-08
Springboot中如何使用Redisson实现分布式锁浅析
redisson是redis的java客户端程序,国内外很多公司都有在用,下面这篇文章主要给大家介绍了关于Springboot中如何使用Redisson实现分布式锁的相关资料,需要的朋友可以参考下2021-10-10


最新评论