The publish/subscribe communication pattern involves one event producer and several consumers. This pattern is also often named the observer design pattern. This pattern consists of a unidirectional stream of communication, where one component is the source of events (the producer), and one, or several, components are sinks of these events (the consumers). The following figure shows how this pattern works:

Figure 12.1: The publish/subscribe design pattern

The principle of this pattern is to decouple the producer from the consumers. The producer emits events with no knowledge of the existing consumers. The consumers register ...

Get Hands-On Reactive Programming with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.