Are all messages being immediately consumed, or is there a backlog of
messages for a given message group when you close the message group?  I
would expect the message group to be closed immediately when the message
with NMSXGroupSeg=-1 is sent (not when it is consumed), so if there is a
backlog I would expect the new consumer to start processing with the next
undispatched message (which would be in the 200s), even if the old consumer
is still processing its current message plus the one in its prefetch buffer.

Why are you closing the message group?  Seems like you could avoid the
whole problem just by doing that...
On Dec 17, 2015 5:46 AM, "sburczymucha" <sburczymuchate...@gmail.com> wrote:

> Hello,
>
> I have a strange problem with message groups and multiple consumers - I've
> noticed several cases when message with the same NMSXGroupID was received
> by
> two different consumers, I'm not sure if this is my fault or some other
> edge
> case. How can I debug this?
>
> My setup:
>
> 1. Each consumer has own connection and session
> 2. Every 255 messages NMSXGroupSeq is reset to -1
> 3. Messages are processed in transaction
> 4. Prefetch is set to 1
> 5. ActiveMQ + NMS + listener
>
> Here is a sample output from multiple consumers and one group (with
> consumer
> ID, NMSMessageId, NMSXGroupID, NMSXGroupSeq and JMSXGroupFirstForConsumer),
> logged just after message was passed to consumer (and not yet commited):
>
> http://pastebin.com/raw/V1ZYUNWF
>
> And here are problematic assignments:
>
>
> Consumer 2 receives first message for 1 group
>
> CONSUMER#2 | 2015-12-17 12:33:38.9183 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:1, NMSXGroupID 1,
> NMSXGroupSeq 1, JMSXGroupFirstForConsumer True
> CONSUMER#2 | 2015-12-17 12:33:39.9083 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:2, NMSXGroupID 1,
> NMSXGroupSeq 2, JMSXGroupFirstForConsumer False
>
> Consumer 2 continues his job...
>
> Consumer 3 receives message for group 1, but Consumer 2 already has this
> group. NMSMessageId is from future?
>
> CONSUMER#2 | 2015-12-17 12:33:52.7433 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:74, NMSXGroupID 1,
> NMSXGroupSeq 74, JMSXGroupFirstForConsumer False
> CONSUMER#2 | 2015-12-17 12:33:52.7573 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:75, NMSXGroupID 1,
> NMSXGroupSeq 75, JMSXGroupFirstForConsumer False
> CONSUMER#3 | 2015-12-17 12:33:52.9413 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:257, NMSXGroupID 1,
> NMSXGroupSeq 1, JMSXGroupFirstForConsumer True
> CONSUMER#2 | 2015-12-17 12:33:53.3623 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:76, NMSXGroupID 1,
> NMSXGroupSeq 76, JMSXGroupFirstForConsumer False
>
> And from now on only Consumer 3 is processing messages from group 1
>
> CONSUMER#3 | 2015-12-17 12:33:53.4303 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:77, NMSXGroupID 1,
> NMSXGroupSeq 77, JMSXGroupFirstForConsumer False
> CONSUMER#3 | 2015-12-17 12:33:53.6113 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:78, NMSXGroupID 1,
> NMSXGroupSeq 78, JMSXGroupFirstForConsumer False
>
> And similar situation:
>
> CONSUMER#3 | 2015-12-17 12:34:13.8848 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:233, NMSXGroupID 1,
> NMSXGroupSeq 233, JMSXGroupFirstForConsumer False
> CONSUMER#3 | 2015-12-17 12:34:14.0219 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:234, NMSXGroupID 1,
> NMSXGroupSeq 234, JMSXGroupFirstForConsumer False
> CONSUMER#4 | 2015-12-17 12:34:14.3928 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:513, NMSXGroupID 1,
> NMSXGroupSeq 1, JMSXGroupFirstForConsumer True
> CONSUMER#3 | 2015-12-17 12:34:14.6008 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:235, NMSXGroupID 1,
> NMSXGroupSeq 235, JMSXGroupFirstForConsumer False
> CONSUMER#4 | 2015-12-17 12:34:14.7238 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:236, NMSXGroupID 1,
> NMSXGroupSeq 236, JMSXGroupFirstForConsumer False
> CONSUMER#4 | 2015-12-17 12:34:14.9708 | NMSMessageId
> ID:Developer-QADW3-49592-635859524291587812-1:0:2:1:237, NMSXGroupID 1,
> NMSXGroupSeq 237, JMSXGroupFirstForConsumer False
>
> Again, NMSMessageId is from future, Consumer 3 was processing messages from
> group 1 and in the same time Consumer 4 started to process messages
>
> There are more situations like this in output file
>
>
> Does any one have an idea, what might be wrong with this?
>
> Thank you,
> Best Regards,
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/NMSXGroupID-problem-two-different-consumers-received-message-for-one-group-tp4705096.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to