Event-Driven Architecture & CQRS

Design event-driven systems: events vs commands, brokers, delivery guarantees, outbox, sagas, CQRS read models, event sourcing, tracing and schema evolution.

Start course →

What you'll learn

  • Explain when event-driven architecture helps and when synchronous calls are the better choice.
  • Design well-named, versioned events with envelopes, schemas and the right amount of data.
  • Choose between queues and logs and build idempotent, ordered consumers with retries and dead-letter queues.
  • Publish reliably with the transactional outbox and coordinate multi-service work with sagas.
  • Apply CQRS and event sourcing at the right level, including projections, snapshots and versioning.
  • Observe, test and evolve asynchronous systems, and recognise the common pitfalls.

Syllabus

Why Event-Driven Architecture

  1. From Request-Response to Events
  2. Events, Commands, Queries and the Four Event Patterns
  3. When EDA Fits and When It Does Not

Designing Events

  1. Event Structure and Envelopes
  2. Schemas and Evolution
  3. Thin vs Fat Events, Domain vs Integration Events

Brokers and Delivery Guarantees

  1. Queues, Topics and Logs
  2. Delivery Semantics and Idempotent Consumers
  3. Ordering, Retries and Dead Letters

Reliable Publishing and Sagas

  1. The Dual-Write Problem and the Transactional Outbox
  2. Sagas: Choreography and Orchestration
  3. Inbox, Idempotency Keys and Exactly-Once Illusions

CQRS

  1. Command Query Responsibility Segregation
  2. Read Models, Projections and Eventual Consistency
  3. Levels of CQRS and When to Stop

Event Sourcing

  1. Events as the Source of Truth
  2. Snapshots, Versioning and Replays
  3. Event Sourcing Trade-offs

Observability, Testing and Evolution

  1. Tracing and Monitoring Asynchronous Flows
  2. Testing Event-Driven Systems
  3. Migrating Towards Events Safely

Putting It Together and Revision

  1. Case Study: An E-Commerce Order Flow
  2. Common Pitfalls
  3. Managed Event Services in the Cloud
  4. Revision and Interview Questions