Posted On: Aug 24, 2021
Retained messages is a standard MQTT feature that provides an easy way for you to store the latest important message on a topic for future subscribers. With AWS IoT Core, you can now use retained messages to easily push configuration information or important updates to devices without knowing exactly when they will come online.
When you publish a message with the retained flag set, all current subscribers to that topic will receive the message as normal, but AWS IoT Core will also store the message and automatically deliver it to any future subscribers. As a result, you do not have to worry about tracking when devices come online in order to make sure they receive the message, or alternatively having them wait for the next publish message.
You can use the AWS IoT Device SDKs or your own MQTT 3.1.1 compliant client to publish a retained message. Alternatively, you can use HTTP APIs via the AWS CLI to publish, get, and retrieve the retained messages. In addition, you can view and manage retained messages in your account from the Retained Messages page in the AWS IoT Core console. This page provides a paginated list of MQTT topics that have a retained message, and enables you to retrieve, update, or delete the retained message for a specific MQTT topic.