Phase 2 of 4 · Study weeks 5-8
Service design, data and events
This phase makes the second checkpoint possible: a service whose modules are separate, whose database changes are safe and whose events are never lost.
Topics every week
- Week 58 h
- Spring Boot 4 and Spring Framework 7
- Modular monolith and Spring Modulith
- Auto-configuration and slices
- Testcontainers
Hand inA modular service where a cross-module call fails a test
- Week 68 h
- Transactions and isolation
- Connection pools and sizing
- Indexes and plans
- Expand and contract schema changes
Hand inA schema change shipped in two steps under load with no failed request
- Week 78 h
- The outbox pattern
- Kafka producers, consumers and offsets
- Idempotent consumers
- Event schema evolution
Hand inAn outbox publisher and an idempotent consumer, tested with broker restarts
- Week 88 h
- Timeouts, retries and circuit breakers
- Bulkheads and load shedding
- Backpressure to callers
- Failure injection
Hand inCheckpoint 2, with the 20-kill table and the slow-database run
Practice projects
- Practice 1, the module boundary (Week 5): split orders, billing and shipping into modules. Done when: a Modulith verification test fails on a seeded cross-module call and passes after the fix.
- Practice 2, expand and contract (Week 6): rename a column while 300 requests a second run. Done when: a test runs both versions of the code against both versions of the schema with no failed request.
- Practice 3, the duplicate event (Week 7): kill the broker mid-batch. Done when: the consumer sees the same event twice and the second one changes nothing.
- Optional, a poison message: send an event the consumer cannot parse. Done when: it lands in a dead-letter topic and the main topic keeps flowing.
GitHub repos to study
Existence and last commit were checked on 22 Nov 2026 by shallow clone. Every repository below had a commit in the last 12 months.
| Repo | What to read | Week |
|---|---|---|
| spring-projects/spring-boot | Auto-configuration classes and the conditions that guard them | 5 |
| spring-projects/spring-modulith | Module verification and the event publication registry | 5 |
| testcontainers/testcontainers-java | How containers start for a test and how they are cleaned up | 6 |
| apache/kafka | The producer, the idempotent producer and the consumer group | 7 |
| resilience4j/resilience4j | Circuit breaker and bulkhead state machines | 8 |
Milestone checkpoint
Build Checkpoint 2. Write the 20-kill script and the slow-database proxy first and watch the service fail. Add the outbox, the idempotent consumer, the timeouts and the load-shedding rule. Hand in the 20-kill table, the schema-change test, ADR-3 (outbox against direct publish) and ADR-4 (timeouts and the retry budget).
Check yourself
Answer each question in your head first, then open it to check.
Why is "write to the database, then publish to Kafka" unsafe, and what does an outbox change?
The process can die between the two steps and lose the event. An outbox writes the event in the same transaction as the order, and a separate publisher sends it, at least once.What does an idempotent consumer need to remember?
A key for each processed event (an event id or a business key) stored in the same transaction as its effect.Why can a retry make an outage worse?
Retries add load to a service that is already slow. Limit retries with a budget, use backoff with jitter and stop with a circuit breaker.What does expand and contract mean for a column rename?
Add the new column and write to both, move readers, then drop the old column in a later release. Each step works with the code before and after it.How do you size a connection pool, and why is bigger not better?
Little's law gives the calls in flight; add headroom. A bigger pool moves the queue into the database, where it hurts every other client.