Event-Driven Architecture with Spring Boot 4.x and Kafka 4.x
Sixteen chapters covering event-driven architecture from first principles to production operations. Builds real event-driven systems with Spring Boot 4 and Kafka, then covers CQRS, event sourcing, the saga pattern, idempotency, schema evolution, and observability. Every pattern is implemented and tested with working code.
What you'll learn
Kafka topics, partitions, consumer groups, and KRaft mode without ZooKeeper
Sending and receiving events with Spring Kafka and @KafkaListener
CQRS: separating read and write models with eventual consistency
Event sourcing: the event store, aggregates, snapshots, and GDPR
The saga pattern: choreography vs orchestration with compensating transactions
The outbox pattern and change data capture for reliable event publishing
Idempotency keys and deduplication under at-least-once delivery
Schema evolution with Avro and the Confluent Schema Registry
Testing event-driven systems with EmbeddedKafka and Testcontainers
Table of Contents
Why EDA
- 01 Why Event-Driven Architecture?
- 02 Apache Kafka from the Ground Up
- 03 Spring Boot 4 + Kafka
Patterns
- 04 CQRS: Separating Reads from Writes
- 05 Event Sourcing
- 06 CQRS + Event Sourcing Together
- 07 The Saga Pattern
- 08 Eventual Consistency
Reliability
- 09 The Outbox Pattern
- 10 Idempotency and Duplicate Handling
- 11 Schema Evolution
Operations
- 12 Observability
- 13 Testing Event-Driven Systems
- 14 Cache Coherence in Distributed Read Models
- 15 Migrating to Event-Driven Architecture
- 16 Multi-Tenant Event-Driven Systems