最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

解決RabbitMq queue異常導(dǎo)致consumer停止問題

 更新時間:2026年05月06日 10:35:11   作者:Leon_Jinhai_Sun  
該問題為RabbitMQ隊列異常導(dǎo)致消費者停止消費,錯誤碼404表示隊列不存在或broker不允許使用該隊列,原因可能為RabbitMQ服務(wù)異?;蚺渲脝栴},建議檢查RabbitMQ服務(wù)狀態(tài),確認(rèn)隊列名稱正確,并適當(dāng)調(diào)整消費者重試策略

RabbitMq queue異常導(dǎo)致consumer停止

偶發(fā)性rabbitmq出問題或者認(rèn)為操作錯誤,訪問不了queue,導(dǎo)致消費端停止消費

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: null
    at 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 omitted
    
    Stopping 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

查代碼跟蹤,如下配置設(shè)置

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 {

    @Bean
    public 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訪問失敗場景 會一直重試 直到可用,默認(rèn)5次

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • SpringBoot連接Hive實現(xiàn)自助取數(shù)的示例

    SpringBoot連接Hive實現(xiàn)自助取數(shù)的示例

    這篇文章主要介紹了SpringBoot連接Hive實現(xiàn)自助取數(shù)的示例,幫助大家更好的理解和使用springboot框架,感興趣的朋友可以了解下
    2020-12-12
  • Java實現(xiàn)ArrayList自動擴(kuò)容

    Java實現(xiàn)ArrayList自動擴(kuò)容

    ArrayList的擴(kuò)容規(guī)則是非常簡單的,它會根據(jù)需要自動擴(kuò)容,本文就來介紹一下Java實現(xiàn)ArrayList自動擴(kuò)容,具有一定的參考價值,感興趣的可以了解一下
    2023-12-12
  • 解決Java中的java.io.IOException: Broken pipe問題

    解決Java中的java.io.IOException: Broken pipe問題

    這篇文章主要介紹了解決Java中 java.io.IOException: Broken pipe的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-06-06
  • 如何更快樂的使用Java 8中的Lambda特性

    如何更快樂的使用Java 8中的Lambda特性

    從java8出現(xiàn)以來lambda是最重要的特性之一,它可以讓我們用簡潔流暢的代碼完成一個功能。下面這篇文章主要給大家介紹了關(guān)于如何更快樂的使用Java 8中的Lambda特性的相關(guān)資料,需要的朋友可以參考下
    2018-11-11
  • 淺談Java繼承中的轉(zhuǎn)型及其內(nèi)存分配

    淺談Java繼承中的轉(zhuǎn)型及其內(nèi)存分配

    這篇文章主要介紹了淺談Java繼承中的轉(zhuǎn)型及其內(nèi)存分配,首先分享了簡單的代碼及運行結(jié)果,然后對其進(jìn)行分析,繼而引出了
    2017-11-11
  • 深入剖析Java編程中的序列化

    深入剖析Java編程中的序列化

    這篇文章主要介紹了深入剖析Java編程中的序列化,文中談到了序列化時對象的繼承等各種問題,案例詳盡,強(qiáng)烈推薦!需要的朋友可以參考下
    2015-07-07
  • Java語言----三種循環(huán)語句的區(qū)別介紹

    Java語言----三種循環(huán)語句的區(qū)別介紹

    下面小編就為大家?guī)硪黄狫ava語言----三種循環(huán)語句的區(qū)別介紹。小編舉得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-07-07
  • JavaScript中棧和隊列應(yīng)用詳情

    JavaScript中棧和隊列應(yīng)用詳情

    這篇文章主要介紹了JavaScript中棧和隊列應(yīng)用詳情,棧如果用數(shù)組模擬的話是類似于一個U形桶狀堆棧空間,文章圍繞制圖展開詳細(xì)的內(nèi)容展開更多相關(guān)內(nèi)容,需要的小伙伴可以參考一下
    2022-06-06
  • Spring mvc Controller和RestFul原理解析

    Spring mvc Controller和RestFul原理解析

    這篇文章主要介紹了Spring mvc Controller和RestFul原理解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-03-03
  • spring boot 測試單元修改數(shù)據(jù)庫不成功的解決

    spring boot 測試單元修改數(shù)據(jù)庫不成功的解決

    這篇文章主要介紹了spring boot 測試單元修改數(shù)據(jù)庫不成功的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-09-09

最新評論

湛江市| 静乐县| 永康市| 浪卡子县| 济阳县| 井冈山市| 凤凰县| 化州市| 裕民县| 富阳市| 瓮安县| 道真| 宿迁市| 惠来县| 东乌珠穆沁旗| 济阳县| 蒙城县| 乌审旗| 龙门县| 定西市| 乐亭县| 承德市| 五常市| 漠河县| 南陵县| 延吉市| 石柱| 紫阳县| 同心县| 平凉市| 昆明市| 朝阳区| 宝丰县| 洛浦县| 融水| 松潘县| 东乌| 崇明县| 襄垣县| 武穴市| 威宁|