Recall & Review
beginner
What is a retained message in MQTT?
A retained message is a special message that the MQTT broker stores and sends immediately to any client that subscribes to the topic. It keeps the last message sent on that topic.
Click to reveal answer
beginner
How does a retained message help new subscribers?
New subscribers get the last retained message right after subscribing, so they immediately have the latest information without waiting for the next update.
Click to reveal answer
intermediate
How do you publish a retained message using MQTT command line?
Use the option to mark the message as retained. For example: <br>
mosquitto_pub -t 'home/temperature' -m '22°C' -r <br>This publishes '22°C' as a retained message on the topic 'home/temperature'.Click to reveal answer
intermediate
What happens if you publish a retained message with an empty payload?
Publishing a retained message with an empty payload clears the retained message on that topic. The broker deletes the stored message.
Click to reveal answer
intermediate
Why should you be careful when using retained messages?
Because retained messages stay on the broker until cleared, outdated or wrong data can be sent to new subscribers if not managed properly.
Click to reveal answer
What does a retained message do in MQTT?
✗ Incorrect
A retained message stores the last message on a topic so new subscribers get it immediately.
How do you clear a retained message on a topic?
✗ Incorrect
Publishing an empty retained message clears the stored retained message on that topic.
Which MQTT command publishes a retained message?
✗ Incorrect
The '-r' flag in mosquitto_pub marks the message as retained.
When does a new MQTT subscriber receive a retained message?
✗ Incorrect
New subscribers get the retained message immediately after subscribing.
What is a risk of using retained messages carelessly?
✗ Incorrect
Retained messages stay until cleared, so old data can be sent if not updated.
Explain what retained messages are and how they help MQTT clients.
Think about how new clients get the latest info without waiting.
You got /3 concepts.
Describe how to publish and clear retained messages using MQTT commands.
Focus on the command line options and what happens on the broker.
You got /3 concepts.