Developing Microservices with Aggregates
summary
Argues that Domain-Driven Design aggregates let a tangled domain model split into services by using one transaction per aggregate and referencing other aggregates by ID only, avoiding object links across services. Replaces distributed two‑phase commits with sagas with compensating transactions driven by events (example: order created -> customer reserves credit -> order approved/rejected). Recommends event sourcing as atomic persist-and-publish and shows a microservice design built on Spring Cloud and an event store that yields eventual consistency and an audit-ready event log.
AI-written summary · about
chapters (32)
- 0:00Developing Microservices with Aggregates
- 0:53About Chris
- 4:31Microservice architecture
- 5:58Domain model = tangled web of classes
- 7:07Reliance on ACID transactions to enforce invariants
- 9:46and requires 2PC
- 10:112PC is not an option
- 11:58Domain Driven Design - building blocks
- 14:36About Aggregates
- 16:18Aggregate: rule #1
- 17:30Domain model = collection of loosely connected aggregates
- 17:46Easily partition into microservices
- 18:17Aggregate rule #2
- 19:01Transaction scope = service
- 21:29How to maintain data consistency between aggregates?
- 22:20Using event-driven Sagas instead of 2PC
- 23:49Saga-based, eventually consistent order processing
- 26:53Complexity of compensating transactions
- 29:11How atomically update database and publish an event
- 29:33Failure = inconsistent system
- 31:29Event sourcing = event-centric persistence
- 33:25Persists events NOT current state
- 36:00Replay events to recreate state
- 36:32The Customer aggregate
- 37:29Customer command processing
- 38:09Customer applying events
- 38:57Request handling in an event sourced application
- 39:45Event Store publishes events consumed by other services
- 40:32Event store = database + message broker
- 41:10Benefits of event sourcing
- 46:08Drawbacks of event
- 48:50Summary
related talks
56mDeveloping Event-driven Microservices w/Event Sourcing and CQRS
44mBuilding event-driven microservices with Scala and Functional Domain Models
58mImplementing Event-driven Microservices
47mEvent-Driven Microservices = Microservices Done Right
48mThe Aggregate is dead. Long live the Aggregate!
40mMicroservices without DDD is risky business!
51mPatterns & Practices of Implementing Event-driven MicroSvc...
47mThe Aggregate is dead. Long live the Aggregate!
