Skip to content

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

Think about a school bulletin board. Anyone can pin up a note without knowing who'll read it, and anyone who cares about a topic can check the board without knowing who pinned the notes. The board sits in the middle so the writers and readers never have to find each other. People can start or stop reading anytime, and the writers never even have to notice.

Send to a Channel, Not a Person

Publish Subscribe is a way of sending messages where the sender writes to a channel instead of to a person, and the receiver listens to a channel instead of to a specific sender. A helper in the middle, called a broker, takes each message and passes it along to everyone who signed up for that channel. The neat part is that nobody needs to know who is on the other end: the sender doesn't know who reads it, and the reader doesn't know who wrote it. That means you can add a new listener just by signing up, without telling anyone, and the sender can reach a crowd it can't even count. The whole relationship lives in the channel, not in the two ends.

Anonymous Topic Routing

Publish Subscribe is a messaging pattern where producers emit messages to a topic or channel, not to a recipient, and consumers register interest in the topic, not in any specific producer. A broker, explicit or implicit, sits between them and routes each message to whoever has subscribed. The defining commitment is mutual anonymity through an intermediary topic: the publisher doesn't know who reads, the subscriber doesn't know who wrote, and either side can be added or removed without coordinating with the other. The structural move is decoupling identity from interest, replacing the bilateral question of whom to send to with the unilateral question of what kind of message this is. A subtler point is that the topic itself becomes an object that can be named, monitored, secured, versioned, and given a retention policy, so it can even serve a subscriber that did not exist when the message was first sent. A hormone broadcast into the bloodstream and read only by cells with the matching receptor is a direct biological instance, not a metaphor.

 

Publish-Subscribe is the structural pattern in which producers of information emit messages to a topic or channel, not to a recipient, and consumers register interest in the topic, not in any specific producer. A broker, explicit or implicit, sits between them and routes messages to whoever has subscribed. The defining commitment is mutual anonymity through an intermediary topic: the publisher does not know who reads its messages, the subscriber does not know who wrote them, and either side can be added, removed, or rewritten without coordination with the other, because the relationship is carried by the topic rather than the endpoints. The structural move is decoupling identity from interest: the bilateral question "to whom should I send this?" is replaced by the unilateral "what kind of message is this?", so routing falls out of the topic structure rather than requiring a directory of recipients. This reshapes the message economy, collapsing the cost of adding a consumer to a single subscription operation and letting producers address audiences they cannot enumerate, while the combinatorial growth that bilateral addressing suffers is absorbed by the topic structure. A subtler structural fact is that the topic itself becomes an object that can be named, reasoned about, monitored, secured, versioned, and deprecated; this reification of the channel is what enables asymmetries like audit, replay, and late-join, since a topic with a retention policy can serve a subscriber that did not exist when the message was sent. The pattern carries a computing-and-messaging name and needs light translation when ported, but its biological instances, such as a hormone broadcast into the bloodstream and read only by cells with the matching receptor, are direct rather than metaphorical, which marks the underlying structure as genuinely cross-substrate.

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

One-hop neighborhood: parents above, mutual partners to the right, children below.Publish Subscribecomposition: IndirectionIndirection

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 SubscribeIndirectionLayering

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.