Pattern 14 / COMMS

Publish-Subscribe (Pub/Sub)

Use this when letting many services react to the same business event.

Pressure
Letting many services react to the same business event
Mechanism
Publish an event to a topic and deliver a copy to every subscribed consumer
Toll
Duplicates and ordering differences require idempotent subscribers
Architecture plate14
Diagram for Publish-Subscribe (Pub/Sub)
Executive brief

Publish-Subscribe (Pub/Sub) fits when letting many services react to the same business event. Mechanism: publish an event to a topic and deliver a copy to every subscribed consumer. Use it for event-driven systems where inventory, notifications, analytics, and search all react separately. The toll: duplicates and ordering differences require idempotent subscribers.

Use when

Event-driven systems where inventory, notifications, analytics, and search all react separately.

Example

Ordercreated fan-out to fulfillment, email, and metrics.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Communication Patterns

12Request-Response (Synchronous)13Message Queue (Asynchronous)15Event-Driven Architecture16Webhooks17Server-Sent Events (SSE)18Bidirectional Streaming (WebSockets / gRPC Streaming)
โ† 1315 โ†’