Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-8455

[MQTT] Retained messages don't work well when AMQ is clustered

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Undefined
    • None
    • None
    • clustering, mqtt-protocol
    • None
    • False
    • None
    • False

    Description

      The "retain" implementation for MQTT messages is not ready for a clustered AMQ. The section 3.3.1.3 from this link ( http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718038 ) says this:

      If the RETAIN flag is set to 1, in a PUBLISH Packet sent by a Client to a Server, the Server MUST store the Application Message and its QoS, so that it can be delivered to future subscribers whose subscriptions match its topic name

      It works well when there is one broker in the cluster: all the producers connect to the broker and a new retained message sent into the topic will replace the latest one previously sent.

      When there are more than one broker running, it depends on which broker the producers are connected to.

      Example scenario with two clustered brokers:

      1. A producer A is connected to the broker-0 and sends a retained message into the topic mytopic
      2. The message is stored in the topic, and the broker will deliver it to any new subscriber that subscribes to the topic as long as it connects to broker-0.
        1. If another subscriber connects to broker-1 and subscribes to the same topic mytopic it won't receive any message: the retained message is not redistributed from broker-0.
      3. A producer B connects to the broker-1 and sends a retained message into the same topic name "mytopic".
      4. At that point, there are two different retained messages stored in the cluster: the one on the broker-0 is outdated because there is a newer one published and stored on the other broker. Any new subscriber connecting to the broker-0 receives the old message instead of the new one.
        1. New clients connecting to the broker-1 and subscribing to mytopic receive the most updated message (as they are connected to the broker with the latest retained message).

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ryanezil Rafael Yáñez Illescas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: