Publisher-Subscriber Model
This is one model, used by ROS nodes. The ROS nodes continuously communicate which each other.
- Publish-Subscribe: An asynchronous pattern where messages are published to topics, and multiple subscribers can consume them.
Is pub-sub the same as consumer-producer problem?
No, pub-sub is a messaging pattern, it tells us how messages are communicated between two nodes. Consumer-producer problem is concerned about how synchronization happens.
Another model is Call-and-Response.
Pub-Sub is usually used in event-driven architecture.
The Pub-Sub pattern is one in which a publisher sends a message to a topic on a message broker. A subscriber binds to the topic and receives messages from the topic in an asynchronous manner.
Since the Pub-Sub pattern is asynchronous, there is no blocking lock between sender and receiver. The sender sends the message to the broker and then moves onto other tasks. The receiver accepts a message at its convenience. Messages in the Pub-Sub pattern tend to be discrete, containing all the information that a process needs to act upon the data provided.
https://levelup.gitconnected.com/ros-spinning-threading-queuing-aac9c0a793f