偶发性rabbitmq出问题或者认为操作错误,访问不了queue,导致消费端停止消费

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:599)at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[s.message.like.add]at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)... 2 common frames omitted
Caused by: java.io.IOException: nullat com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)at sun.reflect.GeneratedMethodAccessor711.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)at com.sun.proxy.$Proxy231.queueDeclarePassive(Unknown Source)at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)... 3 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - failed to perform operation on queue 'q.hell' in vhost '/' due to timeout, class-id=50, method-id=10)at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)... 11 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - failed to perform operation on queue 's.message.like.add' in vhost '/' due to timeout, class-id=50, method-id=10)at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)... 1 common frames omittedStopping container from aborted consumer

跟踪

SimpleMessageListenerContainer

catch (QueuesNotAvailableException ex) {logger.error("Consumer received fatal=" + SimpleMessageListenerContainer.this.mismatchedQueuesFatal+ " exception on startup", ex);if (SimpleMessageListenerContainer.this.missingQueuesFatal) {logger.error("Consumer received fatal exception on startup", ex);this.startupException = ex;// Fatal, but no point re-throwing, so just abort.aborted = true;}publishConsumerFailedEvent("Consumer queue(s) not available", aborted, ex);}

SimpleMessageListenerContainer.this.missingQueuesFatal = true 将aborted

查代码跟踪,如下配置设置

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class RabbitConfiguration {@Beanpublic SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(SimpleRabbitListenerContainerFactoryConfigurer configurer,ConnectionFactory connectionFactory) {SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();//Whether to fail if the queues declared by the container are not available on the broker and/or whether to stop the container if one or more queues are deleted at runtime.factory.setMissingQueuesFatal(false);configurer.configure(factory, connectionFactory);return factory;}}

至此涉及queue访问失败场景 会一直重试 直到可用,默认5次

RabbitMq queue异常导致consumer停止相关推荐

  1. RabbitMQ 连接异常导致容器中的SpringBoot 项目退出问题分析

    1.首先描述一下问题: 今日在开发环境提测时,发现了部署在容器中的后台服务一直在重新启动,导致无法提供服务. 2.项目背景 采用了 Springboot+nacos,消息中心使用mq,使用依赖 // ...

  2. 从源码角度分析RabbitMQ重启后,消费者停止消费怎么解决

    前段时间的RabbitMQ broker服务端由于某个队列一直积压消息,运维在凌晨对mq服务端机器pod进行了扩容,重启了RabbitMQ,然后早上发现自己的服务在mq重启之后一直报异常,停止消费了, ...

  3. Celery多个定时任务使用RabbitMQ,Queue冲突解决

    Celery多个定时任务使用RabbitMQ,Queue冲突解决 一. 场景描述 使用celery实现定时任务后,任务会被定时添加到后端指定的队列里,队列可以是RabbitMQ,也可以是redis. ...

  4. 一、RabbitMQ初使用(Consumer)

    RabbieMQ使用过程中的小问题 在rabbitmq的使用过程中,记录一些自己的使用问题 因为在我当前的项目中,我只是一个独立的分析jar,各位看官按自己需求修改 首先是pom引用: <dep ...

  5. 关于线程池运行过程中,业务逻辑出现未知异常导致线程中断问题反思

    最近在项目研发中的关于线程池应用过程中由于业务逻辑异常导致的线程中断,但程序未中断导致的脏数据问题  话不多说,在最近最新的一个版本发布过程中,业务需要,我们要定期去给客户预留出可用的资源数据,提供客 ...

  6. 解决android 异常导致应用程序停止运行的错误

    (一) 前言 各位亲爱的午饭童鞋,是不是经常因为自己的程序中出现未层捕获的异常导致程序异常终止而痛苦不已?嗯,是的.. 但是,大家不要怕,今天给大家分享一个东东可以解决大家这种困扰,吼吼! (二) U ...

  7. java启动RabbitMQ消息报异常解决办法

    java启动RabbitMQ消息报异常解决办法 参考文章: (1)java启动RabbitMQ消息报异常解决办法 (2)https://www.cnblogs.com/meilibao/p/11357 ...

  8. Chrome浏览器对统一资源发出多个请求时,导致最多停止20s问题

    Chrome浏览器对统一资源发出多个请求时,导致最多停止20s问题 Chrome浏览器对统一资源发出多个请求时,导致最多停止20s问题 使用环境: 问题描述: 解决方案: 永久: 临时: 参考文档主要 ...

  9. 为什么开软件计算机停止工作原理,出现一个问题,导致程序停止正常工作 请关闭该程序...

    出现一个问题,导致程序停止正常工作 请关闭该程序internet explorer已停止工作,出现了一个问题,导致程序停止正常工作.请关闭该程序遇到这个问题,不知道有没有软件的错误日志. 出现一个问题 ...

最新文章

  1. MOS管电源开关电路的软启动
  2. Cent6.5 64位yum安装mysql5.5
  3. java map操作_Java 8 中的 Map 骚操作,学习下!
  4. Spring对Hibernate事务管理
  5. 移动智能家庭终端技术规范学习总结
  6. 大数据处理系列之(一)Java线程池使用
  7. l4 l7 代理_什么是四层(L4 proxy)和七层负载均衡(L7 proxy)?区别是什么? 翻译自Nginx官网...
  8. java用NIO实现文件传输_Java Nio 实现文件的传输
  9. 以30字符宽居中输出python字符串_Python3 字符串
  10. maya导出fbx没动画_fbx在maya和max之间的互导问题及解决方法
  11. 用阿里云盘,找不到资源怎么办???
  12. html%3c怎么表示,怎么打出英寸符号 英寸和英尺分别用什么符号表示?
  13. magicbook java开发_荣耀MagicBook2019 Intel版值得买吗 MagicBook2019 Intel版笔记本详细评测...
  14. 如何从ST官网下载STM32标准库
  15. Chrome浏览器标签管理插件–OneTab
  16. 编程小白学习编程的开始
  17. 数据查询和业务流分开_滴滴实时数仓逐层剖解:实时与离线数据误差0.5%
  18. 如何选择及管理腾讯云 MySQL 数据库
  19. 吴恩达机器学习(第2周--Computing Parameters Analytically)
  20. Python中的 if 语句简单介绍,中英文完整理解

热门文章

  1. ASP.NET+SQL创建存储过程
  2. SQL2005使用游标的实例(SBO中计算到期应收账款)
  3. HTML 中的字符实体集
  4. ThreadPoolExecutor线程池详解
  5. MySQL安装教程图解
  6. tcp ip协议笔记(1)——简单介绍
  7. 转Delphi中Create(nil),Create(self),Create(Application)区别
  8. Appium环境搭建python篇(mac系统)
  9. 关于html5的几个新标签在IE9之前不支持的解决办法
  10. Jquery 温习,温故而知新,可以为师矣