From last year, my team study and start to apply microservices architecture to our company projects. And beside of benefits of that architecture, we also started to face with many bad-part of it (cost and benefit :D). One of the biggest problems is a separation of data on many services and raise the hard-way to get the big picture of information for client view.
And, applying CQRS (Command Query Responsibility Segregation) and ES (Event Sourcing) to projects architecture is the best choice to resolve that issue. Let's discuss very powerful patterns and how to apply them in our projects.
4. - Normalize database is hard, retrieving data from that is harder
Problems - from a common search
Which one is better?
5. - One of the principles of microservices is that a service should not directly
access another service's data store
Problems - to microservices architecture
8. “CQRS is not a silver bullet...CQRS is not Event Sourcing...CQRS is not a good wife
...but...CQRS can open many doors”
CQRS
Greg Young
9. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
10. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
I want something done
Commands
11. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
I want something done
Commands
I want to know something
Queries
12. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
I want something done
Commands
I want to know something
Queries
UI
13. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
- Event sourcing: what actually happened?
CQRS - the concepts
I want something done
Commands
I want to know something
Queries
UI
events
14. - Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
- Event sourcing: what actually happened?
CQRS - the concepts
I want something done
Commands
I want to know something
Queries
UI
events
Event
store
18. - Use separate write/read model inside an application
Applying CQRS concept
19. - Use separate write/read model inside an application
Applying CQRS concept
- DB View (not bad)
- Spring JPA native query
@Query,
@NamedNativeQueries
- NoSQL/full text search store
for read side
20. - CQRS/ES based frameworks
- Axon framework
- Lagom framwork
- Eventuate ES
- ….
Applying CQRS concept