Re-reading your original question, I realized that I assumed that you were aware of the JMS-standard feature called message groups, which ensure that all messages with a given group ID are consumed (in order) by a single consumer. That feature will meet all of your requirements except for the ability for multiple consumers to participate in the consumption, so if you weren't aware of it, please consider whether it will meet your needs. See http://activemq.apache.org/message-groups.html for a description of ActiveMQ's implementation of this JMS-standard feature.
If you already knew about that feature and really wanted a multi-consumer variant, read on. For message groups, I didn't mean to imply that the assignment of consumers to group IDs was done at configuration time rather than runtime. The broker assigns whichever consumer is available to an unassigned group, automatically and without any advance configuration. What we don't do is allow multiple consumers to be jointly assigned to the group but ensure that no more than one is consuming a message from the group at the same time, which is what I understand you to be proposing. There isn't a good way for the broker to dispatch messages in the same group to two consumers but control when they process the message, so the only way it could work is to not dispatch the next message until the previous one has been acknowledged. If consumers have large prefetch buffers (for performance reasons) this means either a long time between messages in the group being consumed (i.e. poor performance) or all the messages in the group going to the same consumer (which is what you already get from the existing message group feature). In addition, you would need to define somehow which consumers are in the group and which are not. All of this is possible, and you're welcome to submit JIRA enhancement requests against either/both of ActiveMQ 5.x and Artemis to propose it, but I personally don't see how it's a win over the existing single-consumer message group feature. Unless there's something I'm not considering? Tim On Feb 26, 2018 1:49 PM, "vramanx" <vram...@hotmail.com> wrote: > The group id is dynamic. So we cant really have a set of consumers with a > pre-defined set of group ids. > > One way to handle this is to spin up a singleton actor consumer for a group > id if none exists. > > Will be great if ActiveMQ supports this concept of "dynamic group id" out > of > the box so there is a fixed set of consumers for the MessageGroup. As long > as there is one consumer is processing a message for a group id, then new > messages will not be dispatched. > > > > -- > Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User- > f2341805.html >