Glossary · Industrial communication
MQTT topic
Also known as: Topic (MQTT), Topic name, Topic filter
German: MQTT-Topic
In MQTT, a topic is the UTF-8 string, organized in levels separated by slashes, to which a client publishes a message and against which the broker matches subscriptions, where subscribers may use the wildcards + for exactly one level and # for all remaining levels.
- Industrial communication
- Standards
In one sentence
An MQTT topic is a slash-separated string that messages are published to; subscribers use the wildcards + (one level) and # (all remaining levels).
Example
An edge gateway publishes to plant1/line3/labeler/state; a dashboard subscribes to plant1/line3/+/state for every machine's state and the historian to plant1/# for everything.
How it applies
- Design: MQTT defines the syntax, not the structure. A topic tree is designed, for example along the plant hierarchy (site, area, line, machine, data point), and Sparkplug B prescribes one such structure. Topics are case-sensitive, and a leading slash creates an empty first level.
- Wildcards: + matches exactly one level, # matches the current level and everything below and must stand last. Topics starting with $ (such as $SYS broker statistics) aren't matched by wildcards at the first level.
- Security: Broker access rules are usually defined per topic or topic prefix. A structured tree makes it possible to let a machine publish only to its own branch.
- Documentation: The documentation team documents the topic tree with each topic's payload schema, units, QoS, retain setting and publisher, so consumers don't have to reverse-engineer it.
Topic vs. payload
The topic says where a message belongs; it carries no data type or meaning by itself. The payload schema gives the bytes their meaning: protocol vs. data model again.