Publish/subscribe

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.