阿尔忒弥斯 STOMP 消息过期

huangapple go评论78阅读模式
英文:

Artemis STOMP message expiry

问题

从文档中我仍然不理解如何在 broker.xml 中配置 STOMP 协议的消息过期。我们有一个聊天项目,为每个聊天创建了“多播”地址:

topic/chat.1、topic/chat.2、...、topic/chat.100000

除此之外,我们还使用了“持久订阅”。因此,即使在我们不太流行的项目中,每个月的主题数量可能会超过 50000,这会导致服务器内存耗尽,尤其是当我们转到 web 控制台时。

我希望在删除过期消息时,不必要的地址和队列会被自动删除。

英文:

From the documentation I still do not understand how to configure the expiration of messages for the STOMP protocol in broker.xml.

We have a chat project in which "multicast" addresses are created for each chat

topic/chat.1, topic/chat.2, ..., topic/chat.100000

Among other things, we use "Durable Subscriptions".
Thus, even on our unpopular project, the number of topics per month can exceed 50,000, which causes the server to run out of memory, especially if we go to the web console.

I hope that when deleting expired messages, unnecessary addresses and queues will be automatically deleted

答案1

得分: 1

你可以在文档中提到的address-setting中使用expiry-delay来为所有传入的消息设置过期时间,例如:

<address-setting match="#">
   <expiry-delay>300000</expiry-delay> <!-- 5分钟 -->
</address-setting>

如果你正在使用ActiveMQ Artemis 2.12.0或更新版本,当最后一条消息从没有消费者的自动创建队列中过期时,默认情况下将自动删除队列(如果相应的自动创建地址没有队列,也将默认自动删除该地址)。

英文:

You can use the expiry-delay address-setting mentioned in the documentation to apply an expiration to all incoming messages, e.g.:

<address-setting match="#">
   <expiry-delay>300000</expiry-delay> <!-- 5 minutes -->
</address-setting>

If you're using ActiveMQ Artemis 2.12.0 or later then when the last message expires from an auto-created queue with no consumers then the queue will be auto-deleted by default (and if the corresponding auto-created address then has no queues it will also be auto-deleted by default).

huangapple
  • 本文由 发表于 2020年9月3日 03:42:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/63712558.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定