MQTT supports the delayed publish function, allowing messages to be published after a user-configured time interval.
Delayed publish configuration
On the Dashboard's Management > MQTT advanced features > Delayed publish page, you can view or modify configuration items related to delayed publish.
- Enable delayed publish: Whether to enable the delayed publish function.
- Once enabled, messages can be published after a user-configured time interval.
- Maximum number of delayed messages: The maximum number of delayed messages; by default, there is no limit.
- When a specific limit is set, new delayed messages will not be accepted once this number is exceeded.
Publish delayed messages
After enabling the delayed publish function, publishing messages to MQTT with a special topic prefix from the client will trigger the delayed publish function.
The format description for topics that trigger delayed publish is as follows:
- $delayed: Messages using $delayed as the topic prefix are considered messages that require delayed publish.
- {DelayInterval}: Specifies the time interval for delayed publish, in seconds. If {DelayInterval} cannot be parsed as an integer, MQTT will discard the message and the client will not receive any information.
- {TopicName}: The topic name of the MQTT message.
For example: $delayed/15/mqtt/topic-1 means that the MQTT message will be published to the topic mqtt/topic-1 after 15 seconds.
After you send a delayed message, you can view the list of messages currently within the delayed publish interval on the Dashboard's Monitoring > Delayed publish page.
You can view information such as the topic, QoS, delay time, remaining time, and publish time of delayed messages.