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");
}
}总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
SpringBoot3整合EasyExcel动态实现表头重命名
这篇文章主要为大家详细介绍了SpringBoot3整合EasyExcel如何通过WriteHandler动态实现表头重命名,文中的示例代码讲解详细,有需要的可以了解下2025-03-03
springboot集成PageHelper分页失效的原因及解决
项目启动初期,在集成mybatis的分页插件,自定义封装了一个分页的工具类,方便后期项目的扩展,结果无法分页了,怎么设置搞都没办法正常分页,所以本文将给大家介绍一下springboot集成PageHelper分页失效的原因及解决,需要的朋友可以参考下2023-10-10
Java 方法(方法的定义,可变参数,参数的传递问题,方法重载,方法签名)
这篇文章主要介绍了Java 方法(方法的定义,可变参数,参数的传递问题,方法重载,方法签名),文章围绕主题展开详细的内容介绍,具有一定的参考价值,感兴趣的小伙伴可以参考一下2022-09-09


最新评论