Promptles
Architecture

Pub/Sub (Publish/Subscribe)

intermediate

Definition

A messaging pattern that works like a magazine subscription. One part of the app publishes announcements to a topic without knowing who's listening. Anyone who's subscribed to that topic gets a copy automatically. And you can add new subscribers anytime without telling the publisher.

In the wild

When a customer pays for an order, the checkout system publishes a 'payment received' announcement. The shipping team, the receipt service, and the rewards program all happen to be subscribed, so each one gets the news and reacts. Adding a brand new fraud-detection subscriber later doesn't require any changes to checkout.

More from Architecture