Developing microservices with aggregates - Chris Richardson
Recorded at SpringOne Platform 2016. Slides: http://www.slideshare.net/SpringCentral/developing-microservices-with-aggregates The Domain Model pattern is a great way to develop complex business logic. Unfortunately, a typical domain model is a tangled, birds nest of classes. It can’t be decomposed into microservices. Moreover, business logic often relies on ACID transactions to maintain consistency. Fortunately, there is a solution to this problem: aggregates. An aggregate is an often overlooked modeling concept from the must read book Domain Driven Design. In this talk you will learn how aggregates enable you to develop business logic for the modern world of microservices and NoSQL. We will describe how to use aggregates to design modular business logic that can be partitioned into microservices. You will learn how aggregates enable you to use eventual consistency instead of ACID. We will describe the design of a microservice that is built using aggregates, and Spring Cloud.
Chapters
- 0:00 Intro
- 0:22 Presentation goal
- 1:00 About Chris
- 5:13 Microservice architecture
- 7:57 Domain model = tangled web of classes
- 9:19 Reliance on ACID transactions to enforce invariants
- 11:31 2PC is not a viable option
- 13:26 Domain Driven Design
- 15:39 About Aggregates
- 17:13 Aggregate: rule #1
- 19:23 Aggregate rule #2
- 20:43 Transaction scope = service
- 22:42 Aggregate granularity
- 26:30 Use event-driven, eventually consistent order processing
- 28:54 Eventually consistent credit checking
- 29:54 Complexity of compensating transactions
- 31:37 How atomically update database and publish an event
- 33:15 Reliably publish events when state changes
- 35:06 Event sourcing = event-centric persistence
- 37:05 Persists events NOT current state
- 39:13 Replay events to recreate state
- 40:14 Application architecture
- 42:29 Event Store publishes events consumed by other services
- 44:32 Event store = database + message broker
- 45:33 Benefits of event sourcing
- 48:34 Drawbacks of event
- 53:12 Orders and Customers example
- 54:05 Customer microservice
- 54:56 The Customer aggregate
- 55:58 Familiar concepts restructured
- 56:43 Customer command processing
- 58:20 Customer applying events
- 59:21 Customer Controller
- 59:35 Creating a Customer
- Channel
- SpringDeveloper
- Tags
- Microservices
- Views
- 255