Skip to main content
Articles/distributed systems/system-design-message-queues-and-event-driven-architecture
Series: System Design Interview Prepβ€’Part 15 of 24
Scenario Article

System Design Message Queues and Event-Driven Architecture: Building Reliable Asynchronous Systems

When to Use Event-Driven Queues and When Not To

Abstract Algorithmsβ€’Mar 12, 2026
XLinkedInReddit
πŸ’‘ Executive Summary

Message queues and event-driven architecture let services communicate asynchronously, absorb bursty traffic, and isolate failures.

🎯 System Scenario & Requirements

System Goal

Message queues and event-driven architecture let services communicate asynchronously, absorb bursty traffic, and isolate failures.

Actors & Components

  • Application or API tier
  • Core service under design
  • Operator or SRE observer

Functional Requirements

  • TLDR: Message queues and event-driven architecture let services communicate asynchronously, absorb bursty traffic, and isolate failures.
  • The core design challenge is not adding a queue β€” it is defining delivery semantics, retry behavior, and idempotent consumers.
  • Queues are not a default replacement for APIs.

Constraints & Assumptions

  • When to use - Work is naturally asynchronous: notifications, enrichment, indexing, billing reconciliation.
  • - Producer traffic is bursty, but outcomes can be delayed by seconds or minutes.

⚑ Execution Stages & Decision Trace

1

Stage 1 β€” How the Pattern Works: Producer, Broker, Consumer, Recovery

Action / Decision:

The practical flow is simple to explain and strict to implement.

Component Behavior:

Producer publishes an event with stable schema and idempotency key.

Observable Output: Broker persists and routes events by topic/partition.
Read Full Stage in Deep Dive ↓
πŸ“–

Deep Dive

Detailed Architectural Analysis

Scenario context

Message queues and event-driven architecture let services communicate asynchronously, absorb bursty traffic, and isolate failures. The core design challenge is not adding a queue β€” it is defining delivery semantics, retry behavior, and idempotent consumers.

Queues are not a default replacement for APIs. They are a pressure-relief boundary when synchronous chains become fragile under burst traffic or partial ou…

This walkthrough focuses on When to Use Event-Driven Queues and When Not To.

Before making a design choice, clarify:

  • When to use - Work is naturally asynchronous: notifications, enrichment, indexing, billing reconciliation.
    • Producer traffic is bursty, but outcomes can be delayed by seconds or minutes.
    • You need durable handoff between independently scaled services.

Concepts in play: message-queues, stack-and-queue-data-structures, event-driven-architecture, consistency-replication

Stage 1 β€” How the Pattern Works: Producer, Broker, Consumer, Recovery

  • The practical flow is simple to explain and strict to implement.
  • Producer publishes an event with stable schema and idempotency key.
  • Broker persists and routes events by topic/partition.
  • Consumer processes event side effects.

Observable outcome: Consumer processes event side effects.

Stage 2 β€” Deep Dive: Internals That Make or Break Async Reliability

  • Internals: Ordering, Acknowledgment, and Schema Evolution Ordering is partition-scoped, not global.
  • If one business entity needs strict order, all events for that entity must land on the same partition key.
  • Acknowledgment strategy determines correctness: 1.
  • If you ack before step 3, crashes can lose work.

Observable outcome: If you ack before step 3, crashes can lose work.

Stage 3 β€” Event Pipeline Flow: Publish, Process, Retry, and Recover

  • This is the minimum viable reliability loop.
  • If any node is missing, incident load shifts to manual cleanup.
  • Every path ends in a safe ack or DLQ route β€” there is no silent discard.
  • πŸ“Š Pub-Sub: Publisher to Subscribers This pub-sub sequence diagram shows how a single OrderCreated event published to a topic fans out simultaneously to two independent subscriber services, each of which processes the e…
flowchart TD
    A[Producer validates and publishes event] --> B[Broker topic partition]
    B --> C[Consumer reads event]
    C --> D{Idempotency key already processed?}
    D -->|Yes| E[Ack and skip duplicate]
    D -->|No| F[Execute side effect]
    F --> G{Success?}
    G -->|Yes| H[Record dedupe key then ack]
    G -->|No| I[Retry with backoff]
    I --> J{Retry limit reached?}
    J -->|No| C
    J -->|Yes| K[Route to DLQ and alert owner]
sequenceDiagram
    participant P as Publisher
    participant T as Topic
    participant S1 as EmailService
    participant S2 as InventoryService
    P->>T: Publish OrderCreated event
    T->>S1: Deliver to EmailService
    T->>S2: Deliver to InventoryService
    S1-->>T: Ack
    S2-->>T: Ack

Observable outcome: πŸ“Š Pub-Sub: Publisher to Subscribers This pub-sub sequence diagram shows how a single OrderCreated event published to a topic fans out simultaneously to two independent subscriber services, each of which processes the e…

Stage 4 β€” Real-World Applications: Flash-Sale Checkout Under Hard Constraints

  • Scenario constraints: - 70k checkouts/minute during a 10-minute flash sale.
    • Payment provider has 2% transient timeout rate.
    • Inventory updates must be per-item ordered.
    • Duplicate charge rate must remain under 0.01%.

Observable outcome: - Duplicate charge rate must remain under 0.01%.

Stage 5 β€” Lessons From Running Async Systems in Production

    • Queue adoption is only successful when correctness rules are explicit before the first message is sent.
    • Idempotent consumers are mandatory for at-least-once delivery β€” not optional.
    • Partition strategy is a business decision, not only a scaling decision.
  • Order guarantees map to business entities.

Observable outcome: Order guarantees map to business entities.

End-to-end outcome

When to use - Work is naturally asynchronous: notifications, enrichment, indexing, billing reconciliation.

Alternatives considered

Decision Guide: Queues vs Synchronous Calls in Architecture Reviews

The retry and dead-letter semantics in AMQP are expressed through the acknowledgment itself.

Failure and degraded modes

When to use

  • Detection: - Work is naturally asynchronous: notifications, enrichment, indexing, billing reconciliation.
  • User or operator impact: - Work is naturally asynchronous: notifications, enrichment, indexing, billing reconciliation.

When not to use

  • Detection: - A user-facing action needs immediate, deterministic completion.
  • User or operator impact: - A user-facing action needs immediate, deterministic completion.

Trade-offs & Failure Modes: Trade-offs and Failure Modes: Queue-Centric Design Risks

  • Detection: Trade-offs & Failure Modes: Trade-offs and Failure Modes: Queue-Centric Design Risks
  • User or operator impact: Trade-offs & Failure Modes: Trade-offs and Failure Modes: Queue-Centric Design Risks

Share this case study

Discuss architecture trade-offs and lessons with your team.

Share:XLinkedInReddit