Using the pub/sub pattern in Dapr
In microservice architectures, the pub/sub pattern is widely adopted to facilitate the creation of a decoupled communication channel between different parts of an application.
The sender (the publisher) of messages/events is unaware of which microservices would consume them and at which point in time they would do it.
On the receiving end (the subscriber) of this pattern, the microservice expresses an interest in the information shared as messages/events by subscribing to a specific set of information types—or topics, to use a better term. (Note that it is not forced to consume the complete stream of messages; it will be able to distill the relevant information from the rest.)
With a similar perspective, a subscriber is also not aware of the location and status of the publisher, as we can see in the following diagram:
Figure 6.1 – Pub/sub pattern
In Figure 6.1, you can see the pub/sub pattern in action...