ActiveMQ Artemis何时清理组ID映射

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

When does ActiveMQ Artemis clean up the group id map

问题

使用JMSXGroupId属性对消息进行分组时,代理需要维护一个groupId值和消费者的映射,以确保所有具有相同JMSXGroupId的消息都发送到同一消费者。

我们注意到服务器上的组计数仅在我们断开消费者连接时减少。

在幸运的情况下,我们的消费者会长时间存在,因为没有关闭消息监听器的连接的理由。这导致组计数图增加。是否有一种方法可以配置组ID的过期时间?或者其他方式来减少组映射,而无需消费者定期重新连接?

英文:

When grouping messages using the JMSXGroupId property the broker needs to keep a 'map' of groupId values and consumers to assure all messages with the same JMSXGroupId are sent to the same consumer.

We noticed the group count size on the server reduces only when we disconnect consumers.

In a happy case our consumers live for a long time because there is no reason to close the connection of a message listener. This results in increasing group count figure. Is there a way to configure an expiration time for group ids? Or other way to reduce the group map without the need for consumers to reconnect at regular time?

答案1

得分: 0

你有3个选择(没有特定顺序)...

首先,你可以使用“buckets(桶)”分组。这实际上通过使用桶而不是分组ID/消费者的1:1映射来减小地图的大小。有关更多详细信息和配置信息,请参阅文档

其次,你可以配置一个具有“group-timeout(组超时)”的LOCAL grouping-handler,如果组ID在配置的时间内未被使用,则会删除地图条目。例如:

<grouping-handler name="my-grouping-handler">
   <type>LOCAL</type>
   <group-timeout>60000</group-timeout>
</grouping-handler>

使用此配置,任何在一分钟内未被使用的组ID(即60,000毫秒)将被删除。

第三,你可以通过在组中的最后一条消息上设置JMSXGroupSeq属性为-1来手动关闭组。这也在文档中有讨论。

英文:

You've got 3 options here (in no particular order)...

First, you can use group "buckets." This essentially reduces the size of the map by using buckets instead of a 1:1 mapping for the group-id/consumer. Additional details and configuration info is available in the documentation.

Second, you can configure a LOCAL grouping-handler with a group-timeout which will remove map entries if the group ID isn't used for the configured amount of time. For example:

&lt;grouping-handler name=&quot;my-grouping-handler&quot;&gt;
   &lt;type&gt;LOCAL&lt;/type&gt;
   &lt;group-timeout&gt;60000&lt;/group-timeout&gt;
&lt;/grouping-handler&gt;

With this configuration any group ID that isn't used for a minute (i.e. 60,000 milliseconds) will be removed.

Third, you can manually close a group by setting the JMSXGroupSeq property on the last message in the group to -1. This is also discussed in the documentation.

huangapple
  • 本文由 发表于 2020年1月7日 00:49:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/59615966.html
匿名

发表评论

匿名网友

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

确定