Messagingpub/subpubsubtopicsubscription

Publish/subscribe

Definition

In publish/subscribe, producers publish messages to a topic and the broker delivers a copy to each subscription; consumers within one subscription share that copy's work.

In practice

Pub/sub decouples a producer from an unknown and growing set of consumers: adding a fraud check or an analytics pipeline means adding a subscription, not changing the publisher. Each subscription has its own backlog, so a slow or crashed subscriber falls behind on its own without holding up the publisher or the others.

Fan-out multiplies work and storage: every published message is processed once per subscription. Publishers also lose sight of who depends on their events, so schemas need versioning and ownership. Some pub/sub systems (in-memory channels, Redis PUBLISH) keep no backlog, so subscribers that are offline simply miss messages.

Example

An order-placed topic has three subscriptions, billing, shipping and email; one published event creates three deliveries, and the email workers being down does not slow billing.