Skip to content

Pub/Sub

Also called Publish/subscribe

What is Pub/Sub?

Publish/subscribe messaging: send an event to a named topic so each interested subscription can receive it.

A publisher announces what happened; subscribers independently react. A topic is a named channel for those announcements. For example, an order-paid event can reach both a receipt-email subscription and an inventory subscription. Workers sharing one subscription may divide its work, but separate subscriptions each get their own delivery according to the system settings.

When you would use it

Use it when several independent parts of an app should react to the same event.

Common operations

  • Publish an event to a topic.
  • Subscribe each interested consumer and handle duplicate delivery.

Related terms

Where this is taught

Going deeper