Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Courses/Asynchronous and Event-Driven Systems
Lesson 20 of 20

Capstone: designing an event-driven system end to end

Bring the course together: a checklist for every asynchronous edge, a worked example and the numbers to check.

20 min read

A checklist for every asynchronous edge

Every arrow that crosses a queue or stream in your design should have clear answers to the same questions. If you cannot answer one, that is where the design will fail.

  • What is acknowledged to the caller, and when is the data durable?
  • Which delivery guarantee applies, and what makes the consumer idempotent?
  • Which partition key preserves the order that matters?
  • What is the retry policy, and where do poison messages go?
  • What bounds the backlog, and what is the lag objective?
  • How will the event's schema evolve?

Worked example: placing an order

The API writes the order and an OrderPlaced outbox row in one transaction, then returns 202 with the order ID. CDC publishes the event to an orders topic keyed by order ID. A Temporal-style workflow orchestrates the saga: reserve stock, charge the card with the order ID as idempotency key, book shipping, compensating on failure. A notifications consumer queues the confirmation email with backoff and a DLQ. An analytics job windows order events by event time. The client sees status changes over SSE, and resumes from its last sequence number after reconnecting.

Numbers to sanity-check

Run the estimates before drawing the final design. At a peak of 10 000 events per second with 1 KB events, the stream carries 10 MB/s, about 864 GB per day. Seven days of retention is roughly 6 TB, or 18 TB with three replicas. If one consumer instance handles 500 events per second, you need at least 20 instances, so 32 partitions leaves room to grow. If the email provider allows 1 000 sends per second, a burst of 2 million emails takes over half an hour to drain, so set expectations or a priority lane.

Make it observable

Asynchronous systems fail quietly: nothing errors, things just stop arriving. Propagate a correlation ID in message headers so a trace follows one user action across every hop. Measure end-to-end latency as now minus the event's occurred-at time, not just per-service latency. Dashboard consumer lag, oldest message age, retry rate and DLQ depth for every consumer, and alert on those rather than on queue depth alone.

Common mistakes to avoid

Most failures in event-driven designs come from a few recurring mistakes, and each lesson in this course addresses one of them.

  • Publishing an event and writing the database separately (use an outbox)
  • Assuming exactly-once delivery instead of building idempotent consumers
  • Unbounded queues and retries without jitter or budgets
  • Choosing too few partitions, or a key that creates a hot partition
  • Pushing to clients without persisting first or handling reconnects

Key takeaways

  • Answer the same checklist for every asynchronous edge: durability, guarantee, idempotency, order, retries, bounds, schema
  • Combine patterns: outbox for publishing, sagas for workflows, streams for analytics, push for live status
  • Estimate throughput, storage, partitions and drain time before finalising a design
  • Trace across hops and alert on lag and DLQ depth, because async failures are silent

Sign in to track lessons and earn badges.

Workflows: orchestration vs choreography

Challenge checkpoint

Course: 0/20 lessons · 0/10 challenges0%

Build it on the canvas, pass the review (70+) and mark it complete to count it toward the course badge.

  1. 10/10Design a Durable Workflow EngineRun long-lived workflows with durable history, timers, retries, compensation and exactly-once step effects.MAJORHardPRO
All 10 challenges →