这篇文章将为大家详细讲解有关apache artemis如何定时自动清理无效主题队列,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
apache artemis 定时自动清理无效主题队列
删除不活动的队列(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 每十秒检查一次,默认为0,此功能关闭
gcInactiveDestinations: true 删除掉不活动队列,默认为false
inactiveTimoutBeforeGC:30000 不活动30秒后删除,默认为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>
关于“apache artemis如何定时自动清理无效主题队列”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。