MQTT · Study deck
MQTT Publish-Subscribe Basics
Picture a cold-store sensor sending one numbered temperature record.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
Trace a numbered reading from publisher to broker to subscribers.
- Trace one publication route.A publisher sends to the broker; subscribers register their interests.
- Match topic names and filters.Check the packet topic and the filter levels that select it.
- Keep evidence boundaries clear.Delivery, freshness, and physical action need different evidence.
Major section
Start With One Publication
The alarm screen and the archive may listen to the same topic, yet one can update while the other stays stale.
- The send is only the start of the evidence path.
- Telemetry means measurements and status sent from a remote device for review.
- MQTT means Message Queuing Telemetry Transport.
Major section
Start With One Publication (continued)
A broker is the service that routes messages by topic.
- A payload is the useful content carried inside one message.
- This runway does not choose a delivery setting or prove an external action.
- The sensor does not know whether a phone app, alarm panel, logger, or automation rule is listening.
Major section
Broker Routing, Sessions, and Failure Boundaries
A PUBLISH packet carries a topic, a packet identifier when used, and a payload.
- Topic name directs routing.The broker matches the published topic against subscribed filters.
- Packet identifiers support exchanges.For QoS one, it supports the protocol delivery exchange.
- Payload carries application data.A matching route does not validate the reading or its unit.
TOPIC NAME → broker routing
PACKET IDENTIFIER → QoS 1 exchange
PAYLOAD → value and unit for the application
A valid topic match does not validate the temperature schema.
Major section
Route a Boiler Reading Through Topic Filters
Compare the boiler topic with each filter, one level at a time.
- Operations receives the temperature.The plus wildcard covers the single boiler level.
- The alarm receives the branch.The hash wildcard covers the remaining topic levels.
- Pressure does not match temperature.The final literal topic level must agree.
Publish plant/boiler7/temperature = 83.4 C
plant/+/temperature → match
plant/# → match
plant/boiler7/pressure → no match: final level differs.
Major section
Route a Boiler Reading Through Topic Filters (continued)
A last will reports a lost session; an online publication reports reconnection.
- A last will reports connection loss.It is a status publication, not a new temperature measurement.
- Record reconnection separately.The topic names boiler 7 or boiler 8.
- Broker permissions separate clients.Boiler 7 must not publish under boiler 8’s identity.
Major section
Summary
MQTT publish-subscribe routes messages through a broker, so publishers and subscribers do not need direct knowledge of each other.
- Topic design is a product and operations contract, not just a string convention.
- The + wildcard matches one topic level; # matches the remaining levels and should be restricted.
- QoS, retained messages, persistent sessions, and last will shape delivery evidence, but they do not remove the need for application-level freshness and duplicate handling.
Deck summary
Key takeaways
The alarm screen and the archive may listen to the same topic, yet one can update while the other stays stale.
- A broker is the service that routes messages by topic.
- Both consumers can receive the same publication without knowing the sensor's address.
- A boiler publishes plant/boiler7/temperature with payload 83.4 C.
- If boiler 7 loses its MQTT session without a clean close, the broker can publish the stored will to a status topic.
Retrieval practice
Recall check 1 of 5

Broker Bex says: answer from memory, then check your reasoning.
Q1What is the main design value of MQTT publish-subscribe in an IoT deployment?
Show answer
Answer: A MQTT's broker and topic model lets producers and consumers evolve independently, as long as the topic contract remains stable.
Retrieval practice
Recall check 2 of 5

Broker Bex says: answer from memory, then check your reasoning.
Q2A retained command waits for a device that has been offline. What should the design review do before using retained state?
Show answer
Answer: A A retained command can be delivered later; its age and effect need an explicit policy.
Retrieval practice
Recall check 3 of 5

Broker Bex says: answer from memory, then check your reasoning.
Q3A broker accepted a publication, but the dashboard shows no update. Which record best checks the routing boundary?
Show answer
Answer: D The trace separates broker acceptance, filter matching, and forwarding; QoS 0 has no protocol acknowledgement.
Retrieval practice
Recall check 4 of 5

Broker Bex says: answer from memory, then check your reasoning.
Q4A dashboard needs all temperature readings from greenhouse 2, but not other sites or other signal types. Which subscription is the best fit?
Show answer
Answer: A The single-level wildcard covers multiple devices while keeping the site and signal type constrained.
Retrieval practice
Recall check 5 of 5

Broker Bex says: answer from memory, then check your reasoning.
Q5A new dashboard receives every topic under site/#, including maintenance commands and device credentials events it should not see. Which broker-boundary fix is strongest?
Show answer
Answer: D Topic design and broker authorization should constrain what the dashboard can receive.
Print reference
Answers
Answer key.
- A · MQTT's broker and topic model lets producers and consumers evolve independently, as long as the topic contract remains stable.
- A · A retained command can be delivered later; its age and effect need an explicit policy.
- D · The trace separates broker acceptance, filter matching, and forwarding; QoS 0 has no protocol acknowledgement.
- A · The single-level wildcard covers multiple devices while keeping the site and signal type constrained.
- D · Topic design and broker authorization should constrain what the dashboard can receive.