Skip to content

Quality of Service

Rolf Ebert edited this page May 1, 2016 · 2 revisions

MQTT Quality of Service

There is a good explanation of the basic concept of Quality of Service in the MQTT protocol at the HiveMQ page. The main are

  • Only the client sets the QoS level, that's the case for publishing as well as for receiving subscribed messages. In DK's components the QoS levels are defined as:

    type QoS_Level is (At_Most_Once, At_Least_Once, Exactly_Once);
    • At_Most_Once is level 0
    • At_Least_Once is level 1
    • Exactly_Once is level 2
  • The packet identifier is a unique number per client. The packet identifier is needed for the acknowledge protocol between the client and the broker. As the QoS At_Most_Once doesn't use any acknowledgement it doesn't need a packet identifier. Accordingly Dmitry defines a type Packet_Identification as a variant record:

    type Packet_Identifier is new Unsigned_16;
    
    type Packet_Identification (QoS : QoS_Level := At_Most_Once) is
    record
    case QoS is
       when At_Most_Once =>
          null;
       when At_Least_Once | Exactly_Once =>
          ID : Packet_Identifier;
    end case;
    end record;
Clone this wiki locally