We are using message groups in ActiveMQ.
We will have about 100,000 message groups a day with 1 to 10 messages per group. A random (between 1 and 10) number of messages for the group will arrive at unknown times over about a 24 hour period.
Since we don't know how many messages will arrive for a particular message group, we cannot explicitly close the group. We do not want message groups to live forever though, since we suspect it would be a memory leak.
How can we achieve something similar to the below? Is there alternative we are missing?
messageGroup.setTimeToLive(48 hours)?
答案 0 :(得分:0)
您不必担心关闭邮件组;因为消息组不是根据JMSXGroupID
的不同值单独管理的。 ActiveMQ为每个消息组值创建哈希码桶(即JMSXGroupID
值的每个值被散列并分成桶。因此哈希码是针对JMSXGroupID
的字符串值计算的,然后将该值放入一个'哈希桶'因此没有大量可能的值来避免内存耗尽。
因此JMSXGroupID值可以是一个完全随机的字符串,并且代理不会用完RAM。我们应该更新Message Groups documentatio n以使其更清晰!