Uploaded image for project: 'ActiveMQ .Net'
  1. ActiveMQ .Net
  2. AMQNET-248

Duplicate MessageID received.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.3.0
    • Component/s: Stomp
    • Labels:
      None
    • Environment:

      ActiveMQ.NMS 1.2.0 Stomp Protocol
      Windows Mobile 5.x
      Compact Framework 3.5

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              tabish Timothy A. Bish
              Reporter:
              daj Steve Higgins
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: