Which statement best describes the publish-subscribe pattern commonly used in IoT messaging?
Think about how messages flow through a middleman in this pattern.
The publish-subscribe pattern uses a broker to decouple message senders (publishers) from receivers (subscribers). Publishers send messages to the broker, which then forwards them to subscribers interested in those messages.
Given an MQTT broker subscription to the topic home/+/temperature, which published topic will NOT match this subscription?
The + wildcard matches exactly one level in the topic hierarchy.
The subscription home/+/temperature matches topics with exactly three levels where the middle level can be any single word. Option B has 'humidity' instead of 'temperature' at the last level, so it does not match.
Which MQTT client configuration will ensure that the last message published on a topic is stored by the broker and sent immediately to new subscribers?
Consider how the broker knows to keep the last message for a topic.
Setting the retain flag to true when publishing tells the broker to store that message as the last known good value for the topic. New subscribers receive this retained message immediately upon subscribing.
An IoT device subscribes to the topic devices/+/status but does not receive messages published to devices/device1/status. What is the most likely cause?
Think about broker capabilities and wildcard support.
If the broker does not support wildcard subscriptions, the device will not receive messages even if the subscription topic is correct. QoS levels and clean session flags do not prevent wildcard matching if supported.
You need to design an MQTT topic hierarchy for a smart city project with thousands of sensors across multiple districts and sensor types. Which topic design pattern will best support scalability and easy filtering?
Think about how to organize topics for filtering by location and type.
A hierarchical topic structure allows subscribers to filter messages by city, district, sensor type, or specific sensor ID. This supports scalability and efficient message routing.