On this page
What Is Publish-Subscribe?Key TakeawaysHow Does Publish-Subscribe Work?Publisher vs. SubscriberPublish-Subscribe vs. Request-ResponseDoes Publish-Subscribe Require a Message Broker?Why Is Publish-Subscribe Useful for Robotics?Frequently Asked QuestionsThe Bottom LineSourcesRelated termsWhat Is Publish-Subscribe?
Publish-subscribe, often abbreviated pub-sub, is a communication pattern in which software components publish messages to named topics while other components subscribe to receive relevant information.
The sender does not need to know every recipient directly.
Publish-subscribe is widely used in robotics, industrial IoT, cloud applications, and distributed systems.
For example, a robot's camera application may publish images to a topic.
Object-detection and mapping applications can subscribe to that topic to receive the images they need.
Key Takeaways
- Publish-subscribe separates information producers from consumers.
- Multiple applications can subscribe to the same topic.
- Delivery behavior depends on the underlying communication technology and its reliability settings.
How Does Publish-Subscribe Work?
Imagine a mobile robot equipped with LiDAR.
The LiDAR application continuously produces distance measurements.
Navigation software needs those measurements to identify obstacles.
A monitoring application may also need access to them.
Using publish-subscribe, the sensor application publishes measurements to a named topic.
Both the navigation and monitoring applications subscribe to the topic.
Each receives information according to the communication system's configuration.
The sensor application does not need to maintain separate custom interfaces for every consumer.
This makes it easier to build modular robotic software.
Publisher vs. Subscriber
A publisher produces information and sends it to a topic.
A subscriber receives information associated with that topic.
For example, a robot's battery management application may publish battery measurements.
A fleet monitoring application subscribes to those measurements.
A charging-management application may also subscribe.
The same information can support several functions without requiring the publisher to know how each consumer uses it.
Publish-Subscribe vs. Request-Response
These are different communication patterns.
Publish-subscribe: Information is distributed to interested subscribers, often as new events or measurements occur.
Request-response: One application sends a request and another provides a corresponding response.
For example, camera images are naturally suited to a publish-subscribe stream.
Asking a controller to return a particular configuration value may be better suited to request-response.
ROS 2 supports topics for publish-subscribe communication and services for request-response interactions.
Does Publish-Subscribe Require a Message Broker?
Not always.
MQTT commonly uses a broker that receives messages and distributes them to subscribers.
DDS can support distributed publish-subscribe communication without requiring the same centralized broker arrangement.
Both approaches separate producers from consumers, but their infrastructure differs.
The appropriate choice depends on performance, device capabilities, and operating requirements.
Why Is Publish-Subscribe Useful for Robotics?
Robots contain many software components that need information from the same sensors.
A camera recording can be useful to object detection, navigation, and diagnostics.
Publish-subscribe makes it possible to distribute information through defined interfaces.
However, it does not automatically guarantee that every subscriber receives every message.
Reliability, message history, and timing depend on the communication system.
Frequently Asked Questions
Can several subscribers receive the same message?
Yes. That is one of the main benefits of publish-subscribe communication.
Is publish-subscribe suitable for real-time robotics?
It can be, when the middleware, hardware, and configuration meet the application's timing requirements.
The Bottom Line
Publish-subscribe helps robotics applications exchange information without tightly coupling every software component. It is a foundation of modular robot communication.
Sources
Black Scarab Weekly
Follow the physical AI economy
Get Black Scarab news, deep research, and practical analysis in one clear Thursday briefing.