1、找不到队列
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");
}
}