liveBook · Manning

Sink node

As explained in Software Design for Python Programmers

A subscriber is a software component that receives notifications from a publisher and may request and process the publisher's new content.

A subscriber is a component that receives notifications from a publisher and may request, ignore, or process newly available content independently. The publisher tracks subscribers and remains unaware of their implementations. section 12.1 section 12.1.1

A flexible subscriber arrangement lets components:

  • Subscribe or unsubscribe without changing publisher code. section 12.1.1
  • Choose whether and how to process each notification. section 12.1
  • Maintain different responsibilities, such as logging events, accumulating a table, or displaying a graph. section 12.1 section 12.1.2
Figure 12.1 An example of the publisher–subscriber model. The publisher component produces hit events that are consumed as they occur by the subscriber components to generate the various reports.
A diagram of a report

AI-generated content may be incorrect.

Shows a publisher producing events consumed by multiple subscriber components. section 12.1

How Software Design for Python Programmers covers it

How deep it goes
Defines notification, optional retrieval, processing, and subscription behavior, stopping short of a full decoupled implementation.
Examples
Uses news readers and baseball log, table, and graph report generators as subscriber examples.
What it assumes
Assumes only that a publisher produces content and that consuming components can receive and process it.
What you can do after
Apply the subscriber role when designing components that independently consume publisher events.
How it connects
Connects subscribers to the Observer Design Pattern, publisher–subscriber model, producer–consumer model, publishers, subjects, and observers.

Also explained in

Compare how 3 books explain sink node →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Design for Python Programmers. The section links point to the parts of the book it draws on.