Ed McCormic Source on GitHub
All specs

Spring Boot and Java deep dives

Event-driven commerce with Kafka

Orders, inventory, payment, and notifications using a transactional outbox, idempotent consumers, and compensation flows.

View code on GitHub

Design

Each service writes its state change and its outgoing event in a single transaction (the outbox pattern). Consumers are idempotent, retries end in dead-letter topics, and messages are keyed by order ID so each order’s events stay in sequence.

Requirements added step by step

  • Order state machine
  • Release inventory when payment fails
  • Refund when inventory rejects the order
  • Payment waits for inventory-reserved
  • Reservation expiry timeout
  • Automatic refund when payment arrives after the reservation expired
  • Expiry notification sent to the customer

AI build notes

Each compensation path was added in its own prompt, so each one landed with its own tests.

Changelog

  • 2026-09-28: Built over a long iterative session