Glossary · Cloud & Hosting

Publish/Subscribe (Pub/Sub)

Publish/subscribe is a messaging pattern where publishers send messages to topics and every subscriber receives a copy without knowing the sender.

Updated October 6, 2026

Publish/subscribe (pub/sub) is a messaging pattern in which senders, called publishers, send messages to a named topic or channel rather than to specific receivers. A broker delivers a copy of each message to every subscriber of that topic.

Why it matters

Publishers and subscribers do not need to know about each other, so you can add a new consumer, such as an analytics service, without changing the sender. This suits event-driven systems, notifications, live updates and fan-out, where one event must trigger several actions. It differs from a work queue, where each message goes to only one worker.

Systems that implement it include Redis Pub/Sub, Google Cloud Pub/Sub, Amazon SNS, Apache Kafka and RabbitMQ exchanges. Guarantees vary: some retain messages, others deliver only to subscribers connected at that moment.

Example

publish  topic=order.created  {"id": 981}
 -> subscriber: email-service    sends receipt
 -> subscriber: stock-service    reserves items
 -> subscriber: analytics        records sale

Common mistakes

  • Assuming a subscriber that was offline will receive earlier messages; many simple brokers do not store them.
  • Changing a message format without versioning, breaking unknown subscribers.
  • Mixing up fan-out topics with load-balanced queues.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.