Glossary · Automation software engineering and architecture
Publish-subscribe pattern
Also known as: Pub/sub, Publish/subscribe
German: Publish-Subscribe-Muster
In software architecture, the publish-subscribe pattern is a messaging pattern in which publishers send messages to topics without knowing the receivers, and every subscriber of a topic receives the messages published to it.
- Software engineering
In one sentence
In publish-subscribe, publishers send messages to topics without knowing receivers, and all subscribers of a topic receive them.
Example
Each machine publishes its state to an MQTT topic, and the dashboard, the energy monitoring system and the historian all subscribe to it.
Explained in context
Context cards connect this term with others to answer one question. Also in British English and German.
How it applies
- Engineering: Pub/sub supports Loose coupling and one-to-many distribution. MQTT and OPC UA PubSub are common implementations in automation. Topic naming and payload schemas must be governed, or the namespace becomes chaotic.
- Security: Brokers need access control per topic, so a device can only publish or subscribe where it is allowed.
- Documentation: Document the topic structure, payload schema, quality-of-service levels and retained messages. Integrators depend on this more than on descriptions of the broker.
Publish-subscribe vs. request-response
In the Request-response pattern, a client asks a specific server and waits for the answer. In pub/sub, data flows from publishers to any number of subscribers without requests, which suits continuous data such as machine states.