Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-4370

Publishing message with existing topic alias and different topic causes message to be sent to incorrect topic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.29.0
    • 2.31.0
    • MQTT
    • None

    Description

      Description

      When sending MQTT 5.0 publish message with topic alias number that has existing mapping for given connection and new topic, Artemis broker will incorrectly route message to topic from alias mapping instead of topic from publish message. This is incorrect behavior because broker should route message to topic from publish message and update alias mapping with new topic. 

      Section 3.3.2.3.4 Topic Alias in MQTT 5.0 specification states the following:

      A sender can modify the Topic Alias mapping by sending another PUBLISH in the same Network Connection with the same Topic Alias value and a different non-zero length Topic Name. 

       

      Steps to reproduce

      1. Create 2 MQTT subscribers: first on topic1 and second on topic2
      2. Create 1 MQTT publisher
      3. From publisher send publish message on topic1 with MQTT property TOPIC_ALIAS  set to 1
      4. From publisher send publish message on topic2 with MQTT property TOPIC_ALIAS  set to 1

      Current result

      First message is correctly routed to topic1, but second message is incorrectly routed to topic1 instead of topic2
      Method org.apache.activemq.artemis.core.protocol.mqtt.MQTTPublishManager#sendToQueue adds mapping only if alias does not exist

      Expected result 

      Topic field in MQTT publish should have priority over TOPIC_ALIAS property. Topic alias stored under existing alias number should be updated.

      Attachments

        Issue Links

          Activity

            People

              jbertram Justin Bertram
              azyzak Adam Zyzak
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m