“Announce once, reach many”
Publish-Subscribe
Explain it like I'm five
Imagine a town crier standing in the square shouting the news. He doesn't know who's listening — maybe ten people, maybe a hundred. And the listeners don't need to know the crier personally — they just show up at the square when they want news. A newspaper works the same way: the writer publishes once, and anyone who subscribes gets a copy. Your brain does this too — when a neuron fires, it releases chemicals into the gap between cells, and any neighboring neuron that has the right receptor picks up the message. The sender doesn't address it to anyone specific. It just announces.
The Story
The pattern is as old as communication itself. Town criers, church bells, smoke signals — all are publish-subscribe systems where a single broadcast reaches an unknown number of receivers. But the modern form crystallized in the 17th century with the invention of the scientific journal. Before journals, scientists wrote letters to specific colleagues. After journals, they published once and anyone who subscribed could read it. The producer didn't need to know the consumers. The consumers didn't need to know the producer. The journal was the channel.
Software engineers reinvented this in the 1980s with message-oriented middleware, and again in the 2000s with systems like Apache Kafka. But the most elegant implementation might be biological. When a neuron fires, it releases neurotransmitters into the synaptic cleft — a tiny channel. Any downstream neuron with the right receptors picks up the signal. The firing neuron doesn't address the message; it publishes. The receiving neurons subscribe by expressing receptors. This decoupling is what allows the brain to rewire itself — subscribers can come and go without the publisher changing at all.
The frontier is in domains drowning in point-to-point connections. Public health surveillance still relies on manual reporting chains — a doctor calls a health department, which calls the CDC. A pub-sub architecture where clinics publish symptom data to channels and surveillance algorithms subscribe would detect outbreaks days faster. Precision agriculture is another open field: soil sensors, weather stations, and satellite imagery all produce data, but most farms lack the event infrastructure to let different systems subscribe to the signals they need. The pattern is simple. The opportunity is massive.
Cross-Domain Flow
Technical Details
Problem
How do you notify interested parties about events without the producer needing to know who they are or how many there are?
Solution
Producers publish events to a channel. Consumers subscribe to channels they care about. The system delivers events to all subscribers without the producer knowing about them.
Key Properties
- Decoupling — producers and consumers don't know about each other
- Fan-out — one event reaches many subscribers
- Selective subscription — consumers choose what they care about
- Asynchronous delivery — production and consumption happen independently
Domain Instances
Message Queues (Kafka, RabbitMQ)
Software EngineeringModern distributed systems are built on pub-sub middleware. Apache Kafka processes trillions of events per day across companies like LinkedIn, Netflix, and Uber. Producers write events to topics; consumers subscribe to topics they need. The broker handles delivery, ordering, and persistence. This decoupling lets teams build and deploy services independently.
Key Insight
Kafka didn't invent pub-sub — it made it durable and replayable, turning an ephemeral broadcast into an append-only log of events that subscribers can read at their own pace.
Newspaper and Magazine Subscriptions
MediaThe publishing industry is literally named after this pattern. A newspaper publishes once; subscribers receive copies. The editorial team doesn't know each reader. Readers don't coordinate with each other. The subscription model decouples production from consumption and allows the audience to scale without changing the production process.
Key Insight
The word "publish" carries the pattern's entire structure — to make public, to release without a specific recipient, to trust the channel to deliver.
Synaptic Neurotransmitter Release
NeuroscienceWhen a neuron fires, it releases neurotransmitters into the synaptic cleft. The neuron doesn't target specific downstream cells — it publishes molecules into the gap. Any postsynaptic neuron expressing the right receptors subscribes by picking up the signal. This allows neural circuits to rewire (neuroplasticity) without changing the publishing neuron.
Key Insight
The brain's ability to learn and rewire depends on pub-sub — if neurons had to address messages to specific targets, neuroplasticity would be impossible.
Stock Market Ticker Feeds
FinanceStock exchanges publish trade data to ticker feeds. Thousands of trading firms, news outlets, and analytics platforms subscribe to the same feed. The exchange doesn't know or care how many consumers there are — it publishes price changes, and subscribers consume them at their own speed and for their own purposes.
Key Insight
Market data is the purest pub-sub system in finance — one publisher, thousands of subscribers, zero coupling between them.
Syndromic Surveillance Networks
Public HealthDisease surveillance still relies heavily on point-to-point reporting: a hospital reports to a county health department, which reports to the state, which reports to the CDC. Each link is a manual, directed connection. A pub-sub model where healthcare facilities publish anonymized symptom data to channels — and epidemiological algorithms, hospital networks, and researchers all subscribe independently — could detect outbreaks days or weeks earlier.
Key Insight
COVID-19 exposed that disease surveillance is still a chain of phone calls — the epidemiological equivalent of scientists writing personal letters instead of publishing in journals.
Competency-Based Progress Alerts
EducationIn most schools, student progress is locked in gradebooks that only the teacher sees. Parents get report cards quarterly. Tutors have no visibility. A pub-sub model where student mastery events are published to channels — and parents, tutors, counselors, and adaptive learning systems subscribe — would create a responsive support network around each learner. The student's struggles wouldn't wait for a quarterly report to become visible.
Key Insight
A report card is a batch job. Student support should be a real-time event stream — publish the struggle when it happens, and let the right subscribers respond.
Sensor-Driven Farm Event Networks
AgricultureModern farms generate data from soil sensors, weather stations, drones, and satellite imagery — but these data sources are siloed. Each system has its own dashboard. A farm event bus where sensors publish readings and irrigation systems, pest models, and harvest planners subscribe would turn fragmented data into coordinated action. The pattern that powers Netflix's microservices could power a farm's sensor network.
Key Insight
A smart farm is a distributed system with the same coordination problems as a microservice architecture — and pub-sub is the solution in both cases.
Related Patterns
Pub-sub provides the signaling infrastructure that feedback loops need — sensors publish measurements, and controllers subscribe to compute corrections.
Consensus protocols rely on broadcast communication — proposals and votes are published to all participants, who subscribe to the decision channel.
Durable pub-sub systems like Kafka implement the channel as an append-only log — subscribers read from the log at their own pace, and events are never deleted.
Both are hidden distribution networks. Mycelium routes nutrients to trees that need them through underground channels; pub-sub routes events to consumers through message channels. The network is invisible to the participants who benefit from it.
Pub-sub provides the mechanism for cascade propagation — when a keystone event is published, subscribers react and publish their own events, creating the ripple effects that define trophic cascades in information systems.