Publish Subscribe¶
Core Idea¶
Producers emit messages to a topic, not to a recipient, and consumers register interest in the topic, not in any producer; a broker routes between them. The defining commitment is mutual anonymity through an intermediary topic — neither side knows the other, and either can change without coordinating.
How would you explain it like I'm…
The Bulletin Board
Send to a Channel, Not a Person
Anonymous Topic Routing
Broad Use¶
- Computing: event-driven architectures, message brokers, OS signals, the actor model's mailbox-by-topic.
- Journalism and broadcasting: a newspaper or podcast publishes for "readers interested in a beat," and subscribers self-select.
- Financial markets: an exchange's quote feed is published to a topic any number of participants subscribe to.
- Cell biology: a gland releases a hormone into the bloodstream, read only by cells with the matching receptor — bloodstream as broker, receptor as subscription.
- Public-health alerting: emergency broadcasts reach recipients who self-register by geography or device.
- Organisations: posting to a shared channel rather than a named distribution list lets the channel survive personnel turnover.
- Genetics: transcription factors broadcast into the nucleoplasm; only genes with the matching binding site respond.
Clarity¶
Separates three questions bilateral messaging conflates — what is said, what kind of thing is said (the topic), and who hears it — and exposes the broker as load-bearing infrastructure whose guarantees must be specified, not assumed.
Manages Complexity¶
Collapses an N-by-M producer-consumer connectivity matrix into N producers plus M consumers plus a topic taxonomy, so wiring grows linearly rather than quadratically and fan-out plus late-joining are handled by one broker mechanism.
Abstract Reasoning¶
Recognising the pattern lets you reason about decoupling in time (retention lets a subscriber read messages predating it), in identity, and in cardinality at once — and predicts that systems converge on the topic as the unit of governance.
Knowledge Transfer¶
- Newsroom design: the editorial desk deciding what counts as a story is broker governance, with the same latency, fan-out, and retention trade-offs.
- Public-health and internal comms: partitioning the topic space trades alert fatigue (too few topics) against miss-rates (too many).
- Legal and regulatory audit: "what did we know when?" is answered by replaying a topic to a timestamp — an immutable topic-organised log as a primary record.
- Coalition politics: broadcast appeals reach only those with the matching ideological receptor.
Example¶
A checkout service emits an order.placed event to a topic; inventory, shipping, fraud, and analytics each subscribe; a fifth consumer joins with one subscription, no change to the producer — and a tax-audit consumer added months later replays history via retention, so the broker decouples time as well as identity.
Relationships to Other Primes¶
Parents (1) — more general patterns this builds on
- Publish Subscribe presupposes, typical Indirection — Pub-sub routes through a named intermediary TOPIC/broker rather than to a recipient — 'the topic itself becomes an object,' a reified intermediary reference. It presupposes indirection (introducing an intermediary reference that decouples endpoints).
Path to root: Publish Subscribe → Indirection → Layering
Not to Be Confused With¶
- Publish-Subscribe is not Responsibility Diffusion because pub-sub is the routing mechanism whereas responsibility diffusion is the failure mode its anonymity courts (no one owns ensuring a message reaches a needed recipient).
- Publish-Subscribe is not point-to-point messaging because point-to-point carries the relationship in the endpoints whereas pub-sub reifies it in the topic, so neither side knows the other.
- Publish-Subscribe is not trust because pub-sub deliberately removes endpoint knowledge, so security must relocate onto the broker rather than rest on bilateral authentication.