英文:
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:
<grouping-handler name="my-grouping-handler">
<type>LOCAL</type>
<group-timeout>60000</group-timeout>
</grouping-handler>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论