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
在頁面客戶端手動創(chuàng)建所需隊列
解決辦法2
使用代碼自動創(chuàng)建
import org.springframework.amqp.core.Queue; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** * 消息隊列配置類,創(chuàng)建消息隊列 * 路由秘鑰為hello */ @Configuration public class RbbitConfig { @Bean public Queue messageQueue(){ return new Queue("hello1"); } }
總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
IDEA Error:java: 無效的源發(fā)行版: 17錯誤
本文主要介紹了IDEA Error:java: 無效的源發(fā)行版: 17錯誤,這個錯誤是因為您的IDEA編譯器不支持Java 17版本,您需要更新您的IDEA編譯器或者將您的Java版本降級到IDEA支持的版本,本文就來詳細的介紹一下2023-08-08Springboot中如何使用Redisson實現分布式鎖淺析
redisson是redis的java客戶端程序,國內外很多公司都有在用,下面這篇文章主要給大家介紹了關于Springboot中如何使用Redisson實現分布式鎖的相關資料,需要的朋友可以參考下2021-10-10spring boot aop 記錄方法執(zhí)行時間代碼示例
這篇文章主要介紹了spring boot aop 記錄方法執(zhí)行時間代碼示例,分享了相關代碼,小編覺得還是挺不錯的,具有一定借鑒價值,需要的朋友可以參考下2018-02-02