0
0
IOT Protocolsdevops~5 mins

Retained messages in IOT Protocols - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ADeletes all messages on a topic
BEncrypts the message content
CSends messages only to one client
DStores the last message on a topic for new subscribers
How do you clear a retained message on a topic?
APublish a message without the retained flag
BUnsubscribe from the topic
CPublish a message with an empty payload and retained flag
DRestart the MQTT broker
Which MQTT command publishes a retained message?
Amosquitto_pub -t 'topic' -m 'message' -r
Bmosquitto_sub -t 'topic' -r
Cmosquitto_pub -t 'topic' -m 'message'
Dmosquitto_sub -t 'topic'
When does a new MQTT subscriber receive a retained message?
AImmediately after subscribing to the topic
BOnly after the next message is published
COnly if the subscriber requests it
DNever, retained messages are for the broker only
What is a risk of using retained messages carelessly?
ALosing messages permanently
BSending outdated data to new subscribers
COverloading the broker with messages
DPreventing clients from subscribing
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.