About CQRS & ES
Something about CQRS & Event Sourcing patterns
By trinhthethanh25390@gmail.com
- Problems
- Introduction to CQRS & Event Sourcing
- Apply the concepts
- Using Axon framework to implement an example
Outline
Problems - from a common search
215.000.000 results!!!
- Normalize database is hard, retrieving data from that is harder
Problems - from a common search
Which one is better?
- One of the principles of microservices is that a service should not directly
access another service's data store
Problems - to microservices architecture
Question: microservices multiple database challengers??
“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
- Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
- Command Query Responsibility Segregation
- Separate the application into different models for Commands and Queries
CQRS - the concepts
I want something done
Commands
- 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
- 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
- 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
- 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
CQRS - the flow
Image source:microsoft
CQRS - the components
Image source:geekabyte.io
Applying CQRS concept
- Use separate write/read model inside an application
Applying CQRS concept
- 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
- CQRS/ES based frameworks
- Axon framework
- Lagom framwork
- Eventuate ES
- ….
Applying CQRS concept
Example
https://github.com/3t-dev/cqrs-order-portfolio
Thank you!

Cqrs & event sourcing

  • 1.
    About CQRS &ES Something about CQRS & Event Sourcing patterns By trinhthethanh25390@gmail.com
  • 2.
    - Problems - Introductionto CQRS & Event Sourcing - Apply the concepts - Using Axon framework to implement an example Outline
  • 3.
    Problems - froma common search 215.000.000 results!!!
  • 4.
    - Normalize databaseis hard, retrieving data from that is harder Problems - from a common search Which one is better?
  • 5.
    - One ofthe principles of microservices is that a service should not directly access another service's data store Problems - to microservices architecture
  • 7.
    Question: microservices multipledatabase challengers??
  • 8.
    “CQRS is nota silver bullet...CQRS is not Event Sourcing...CQRS is not a good wife ...but...CQRS can open many doors” CQRS Greg Young
  • 9.
    - Command QueryResponsibility Segregation - Separate the application into different models for Commands and Queries CQRS - the concepts
  • 10.
    - Command QueryResponsibility Segregation - Separate the application into different models for Commands and Queries CQRS - the concepts I want something done Commands
  • 11.
    - Command QueryResponsibility 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 QueryResponsibility 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 QueryResponsibility 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 QueryResponsibility 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
  • 15.
    CQRS - theflow Image source:microsoft
  • 16.
    CQRS - thecomponents Image source:geekabyte.io
  • 17.
  • 18.
    - Use separatewrite/read model inside an application Applying CQRS concept
  • 19.
    - Use separatewrite/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 basedframeworks - Axon framework - Lagom framwork - Eventuate ES - …. Applying CQRS concept
  • 21.
  • 22.