溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

apache artemis如何定時(shí)自動(dòng)清理無(wú)效主題隊(duì)列

發(fā)布時(shí)間:2022-01-13 09:21:57 來(lái)源:億速云 閱讀:422 作者:小新 欄目:大數(shù)據(jù)

這篇文章將為大家詳細(xì)講解有關(guān)apache artemis如何定時(shí)自動(dòng)清理無(wú)效主題隊(duì)列,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

apache artemis 定時(shí)自動(dòng)清理無(wú)效主題隊(duì)列

刪除不活動(dòng)的隊(duì)列(Delete Inactive Destinations)

https://my.oschina.net/zengfr

artemis配置:

 <auto-delete-queues>true</auto-delete-queues>
      <auto-delete-created-queues>true</auto-delete-created-queues>
      <auto-delete-queues-delay>86400000</auto-delete-queues-delay>
      <auto-delete-queues-message-count>0</auto-delete-queues-message-count>
      <config-delete-queues>FORCE</config-delete-queues>

      <auto-delete-addresses>true</auto-delete-addresses>
      <auto-delete-addresses-delay>86400000</auto-delete-addresses-delay>
      <config-delete-addresses>FORCE</config-delete-addresses>
         </address-setting>

schedulePeriodForDestinationPurge:10000  每十秒檢查一次,默認(rèn)為0,此功能關(guān)閉
gcInactiveDestinations: true  刪除掉不活動(dòng)隊(duì)列,默認(rèn)為false
inactiveTimoutBeforeGC:30000 不活動(dòng)30秒后刪除,默認(rèn)為60秒

修改activemq.xml 在<broker>里添加屬性schedulerSupport="true" 重啟mq

http://activemq.apache.org/delete-inactive-destinations

<broker xmlns="http://activemq.apache.org/schema/core" schedulePeriodForDestinationPurge="10000">
  <destinationPolicy>
     <policyMap>
        <policyEntries>
           <policyEntry queue=">" gcInactiveDestinations="true" inactiveTimoutBeforeGC="30000"/>
        </policyEntries>
     </policyMap>
  </destinationPolicy>
</broker>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" useJmx="true" 
		dataDirectory="${activemq.data}" schedulePeriodForDestinationPurge="60000">

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
		<policyEntry queue=">" gcInactiveDestinations="true" inactiveTimeoutBeforeGC="30000"/>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

關(guān)于“apache artemis如何定時(shí)自動(dòng)清理無(wú)效主題隊(duì)列”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI