integration
Glossary ↗Publish/Subscribe (Pub/Sub)
Publish/subscribe (pub/sub) is a messaging pattern where senders — publishers — emit events to a named channel or topic without knowing or caring who receives them, and any number of interested consumers — subscribers — independently receive a copy. A message broker sits in the middle, decoupling the two sides completely: the publisher just announces "an order was placed," and whichever services care (billing, email, analytics, inventory) each react on their own. This differs from a point-to-point queue, where each message is handled by exactly one worker; with pub/sub, one event fans out to many. For SaaS builders, pub/sub is the backbone of event-driven architecture. It lets you add new functionality — a Slack notification, a data-warehouse sync — by subscribing a new consumer to existing events, without touching the code that publishes them. That loose coupling is what keeps a growing system maintainable. The trade-offs to plan for: messages can arrive more than once (so consumers should be idempotent) and delivery is asynchronous, so downstream effects aren't instant.
Related terms