Duplicate MessageID received.
-----------------------------

                 Key: AMQNET-248
                 URL: https://issues.apache.org/activemq/browse/AMQNET-248
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: NMS
    Affects Versions: 1.2.0
         Environment: ActiveMQ.NMS 1.2.0 Stomp Protocol
Windows Mobile 5.x
Compact Framework 3.5
            Reporter: Steve Higgins
            Assignee: Jim Gomes


There is a bug which causes duplicate MessageIDs to be received. Note, the 
Message IDs are duplicated not the actual messages.  This happens if a producer 
 sends several messages to the same queue over the same session.

Note 1: In MessageID.cs SetValue(string messageKey) the producerSequenceId is 
stripped from the original unique key when a message is received.

        public void SetValue(string messageKey)
        {
            this.key = messageKey;

            // Parse off the sequenceId
            int p = messageKey.LastIndexOf(":");
            if(p >= 0)
            {
                producerSequenceId = Int64.Parse(messageKey.Substring(p + 1));
                messageKey = messageKey.Substring(0, p);
            }
            producerId = new ProducerId(messageKey);
        }

Note 2: In the Message.cs NMSMessageId get method the unique Id is 
reconstructed without the sequence id. Because the sequence id is part of what 
makes the message id itself unique, multiple received messages will now have 
the same id.

        public string NMSMessageId
        {
            get
            {
                if(null != MessageId)
                {
                    return MessageId.ProducerId.ConnectionId + ":" +
                           MessageId.ProducerId.SessionId + ":" +
                           MessageId.ProducerId.Value;
                }

                return String.Empty;
            }


Suggested Fix: The sequenceID should be added back to the MessageId in the 
above get method unless I am not seeing other potential problems. 

Better Approach: As a side note, with this approach NMS can't be used with any 
other message queue because the current implementation would force the other 
queues to construct their unique message ids the same exact way. In bound 
messages should be void of any message id formatting.  

Steve


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to