शब्दकोश · क्लाउड और होस्टिंग

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.

अपडेट: अक्टूबर 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.

यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.