Class MQTTPublishManager


  • public class MQTTPublishManager
    extends Object
    Handles MQTT Exactly Once (QoS level 2) Protocol.
    • Constructor Detail

      • MQTTPublishManager

        public MQTTPublishManager​(MQTTSession session,
                                  boolean closeMqttConnectionOnPublishAuthorizationFailure)
    • Method Detail

      • sendMessage

        protected void sendMessage​(ICoreMessage message,
                                   org.apache.activemq.artemis.core.server.ServerConsumer consumer,
                                   int deliveryCount)
                            throws Exception
        Since MQTT Subscriptions can overlap, a client may receive the same message twice. When this happens the client returns a PubRec or PubAck with ID. But we need to know which consumer to ack, since we only have the ID to go on we are not able to decide which consumer to ack. Instead we send MQTT messages with different IDs and store a reference to original ID and consumer in the Session state. This way we can look up the consumer Id and the message Id from the PubAck or PubRec message id.
        Throws:
        Exception