To simplify the mechanism used to receive offline messages, ApsaraMQ for MQTT automatically loads offline messages and delivers them to a ApsaraMQ forMQTT client after the client establishes a connection to the ApsaraMQ forMQTT broker and passes permission verification.
Usage notes
- After a ApsaraMQ forMQTT client establishes a connection to the broker, the client must pass the permission verification to enable the automatic loading of offline messages. For example, if a ApsaraMQ forMQTT client adopts the token-based verification mode, you must upload a token and the client must pass the verification before it can receive offline messages.
- An offline message takes a specific amount of time to generate. This is because the pushed message can be determined as an offline message only after the acknowledgment of the ApsaraMQ forMQTT client times out. Therefore, if the ApsaraMQ forMQTT client experiences transient disconnection and reconnection, the client may not be able to immediately receive the latest offline message. The latency is generally 5 to 10 seconds.
- If the number of offline messages exceeds 30, ApsaraMQ for MQTT sends offline messages in batches. Each batch contains 30 messages. Batches are sent at intervals of 5 seconds.
Configuration
Table 1. Combinations of QoS levels and the cleanSession parameter
QoS level | cleanSession=true | cleanSession=false |
QoS0 | Offline messages are not delivered. Only one delivery attempt is made for online messages. | Offline messages are delivered. Only one delivery attempt is made for online messages. |
QoS1 | Offline messages are not delivered. Online messages are guaranteed to reach the intended ApsaraMQ for MQTT clients. | Offline messages are delivered. Offline and online messages are guaranteed to reach the intended ApsaraMQ for MQTT clients. |
QoS2 | Offline messages are not delivered. Online messages are guaranteed to reach the intended ApsaraMQ for MQTT clients and are received only once. | Not supported. |