久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何優(yōu)雅地停止使用@RabbitListener 消費(fèi)消息

How to gracefully stop consuming messages with @RabbitListener(如何優(yōu)雅地停止使用@RabbitListener 消費(fèi)消息)
本文介紹了如何優(yōu)雅地停止使用@RabbitListener 消費(fèi)消息的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

有沒(méi)有辦法優(yōu)雅地停止 ListenerContainer 及其關(guān)聯(lián)的 Consumers.

Is there a way to gracefully stop a ListenerContainer, and its associated Consumers.

我正在努力實(shí)現(xiàn)的目標(biāo).

  1. 停止使用消息.
  2. 優(yōu)雅地停止 ListenerContainer.
  3. 等待長(zhǎng)時(shí)間運(yùn)行的消費(fèi)者,完成后確認(rèn).

我可以使用 consumer.stop() 停止 ListenerContainers,但活動(dòng)的長(zhǎng)時(shí)間運(yùn)行的消費(fèi)者不會(huì)成功完成,處理的消息也不會(huì)acked 并因此將在 ListenerContainer 恢復(fù)后再次處理.

I'm able to stop the ListenerContainers using consumer.stop(), but active long running consumers won't complete successfully, and processed messages won't be acked and will therefore be processed again, once the ListenerContainer has been resumed.

輸出

Waiting for workers to finish.
Workers not finished.
Closing channel for unresponsive consumer: Consumer@6d229b1c

消息已處理,但未確認(rèn).

The message was processed, but not acked.

我或許可以使用 setForceCloseChannel(false) 實(shí)現(xiàn)正常關(guān)閉,但是否可以驗(yàn)證取消的消費(fèi)者是否已完成?SimpleMessageListenerContainer.doShutDown() 有一個(gè)本地范圍的列表cancelledConsumers".

I might be able to achieve a graceful shutdown using setForceCloseChannel(false), but is it possible to verify if the cancelled consumers has finished? SimpleMessageListenerContainer.doShutDown() has a local scoped List "canceledConsumers".

推薦答案

增加關(guān)機(jī)超時(shí)時(shí)間.

請(qǐng)參閱消息偵聽器容器配置.

關(guān)機(jī)超時(shí)

當(dāng)容器關(guān)閉時(shí)(例如,如果其封閉的 ApplicationContext 已關(guān)閉),它會(huì)等待處理中的消息,直至達(dá)到此限制.默認(rèn)為五秒.

When a container shuts down (for example, if its enclosing ApplicationContext is closed), it waits for in-flight messages to be processed up to this limit. Defaults to five seconds.

/**
 * The time to wait for workers in milliseconds after the container is stopped. If any
 * workers are active when the shutdown signal comes they will be allowed to finish
 * processing as long as they can finish within this timeout. Defaults
 * to 5 seconds.
 * @param shutdownTimeout the shutdown timeout to set
 */
public void setShutdownTimeout(long shutdownTimeout) {

這篇關(guān)于如何優(yōu)雅地停止使用@RabbitListener 消費(fèi)消息的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時(shí)間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 午夜精品视频一区 | 日韩av在线一区二区三区 | 久久国产成人午夜av影院武则天 | av手机在线免费观看 | 欧美三级电影在线播放 | 国产免费一区二区三区 | 亚洲另类视频 | 精品国产视频 | 91在线影院 | 中文字幕二区 | 天天拍天天草 | 中文字幕亚洲一区二区三区 | 日本久久精品 | 国产成人精品久久二区二区91 | 欧美在线 | 二区欧美 | 久久免费精品 | 日韩精品成人一区二区三区视频 | 黄色视频a级毛片 | 久久精品一区二 | 欧美精品综合在线 | 黄篇网址 | 国产亚洲精品精品国产亚洲综合 | 青娱乐av | 国产在线一区二区 | 超碰人人艹 | 在线色网| 久久精品色欧美aⅴ一区二区 | 国产精品视频久久久 | 精品一区二区三区四区在线 | 国产精品久久久久久久久久99 | 91在线视频免费观看 | 国产精品免费在线 | 国产在线精品一区二区三区 | 精品欧美一区二区精品久久久 | 免费观看a级毛片在线播放 黄网站免费入口 | 国产成人精品一区二区三区视频 | 国产精品一区二区福利视频 | 伊人无码高清 | 亚洲免费视频网址 | 亚洲 中文 欧美 日韩 在线观看 |