Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
CQRS innovations (English version)
1. CQRS - Innovative solution for problems
of modern enterprise architectures.
Andrey Lomakin (lomakin.andrey@gmail.com)
Artem Orobets (enisher@gmail.com)
January 1, 2013 www.ExigenServices.com
2. Table of content
1. Why CQRS ?
a) Milestones of enterprise architecture history
b) Pitfalls of CRUD
c) CQRS as solution
2. CQRS internals
3. Axon framework as CQRS implementation
2 www.ExigenServices.com
12. Problem #1. Usage of JavaBeans ….
JavaBean – “Reusable software components
that can be manipulated visually in a builder
tool”.
12 www.ExigenServices.com
13. … results in …
1. Broken encapsulation of business
objects.
2. Worse code readability.
3. Harder maintainability.
4. All business logic
is placed in service
methods.
13 www.ExigenServices.com
16. Problem #4:In real life concurrent data
modification conflicts do not exist.
Real life business processes do not have
concurrent data modification conflicts.
Detection of such conflict is sign of flaw in
implementation of business logic.
CRUD does not take this into account.
16 www.ExigenServices.com
19. Problem # 1: Usage of JavaBeans
JavaBeans are still used on query side only
but JavaBean != Domain Entity.
19 www.ExigenServices.com
20. Problem #2. Performance optimization and
consequences.
Data denormailzation is used
on query side only
20 www.ExigenServices.com
21. Data on query side
Each table – reflection of presentation of data on user
screen.
Database are not restricted to be SQL only.
Possible alternatives - Apache Cassandra, HBase,
OrientDB ….
21 www.ExigenServices.com
22. Problem #3. Scalability
Data consistency is needed on business
logic side only.
On query side eventual consistency is
totally acceptable.
22 www.ExigenServices.com
23. Problem #4:In real life concurrent data
modification conflicts do not exist.
Two approaches to present object state
1. In the form of values of variables inside object
23 www.ExigenServices.com
24. Two approaches to present object state
2. In form of event queue
+11.2 M $ + 5.3 M $ - 8.2 M $
Sum: 8.3 M $
24 www.ExigenServices.com
25. Two approaches to present object state
Each aggregate (DDD) – event container.
There is no need to use relational
databases.
It is preferable to have DB with ACID
properties.
25 www.ExigenServices.com
26. Two approaches to present object state
Advantages:
System monitoring support.
Ability rollback system state till any moment in
the past.
Framework for data replication and conflict
resolution.
26 www.ExigenServices.com
28. Architecture of CQRS applications
IV. Architecture of CQRS applications
28 www.ExigenServices.com
29. CQRS – is approach only
CQRS is approach only,
how it will be implemented, depends
on you.
29 www.ExigenServices.com
30.
31. Queries
Multilayer architecture CQRS
DB query DB query
Conversion to domain model Conversion to domain model
Conversion to DTO Conversion to DTO
Transmutation of data Transmutation of data
to client to client
31 www.ExigenServices.com
32.
33. Commands
Command – presentation of business action, action
which is meaningful for end user.
Advantages of usage of commands:
1. Orientation on business problems.
2. Convenient facilities for monitoring and scalability.
33 www.ExigenServices.com
34.
35.
36. ….advantages…..
1. Good preconditions for DDD usage.
2. Usage of complex event processing
possibilities.
3. Simplicity of distribution of responsibilities
between highly specialized commands.
36 www.ExigenServices.com
49. Axon – repository и event store.
Repository
JPA
Event Store
File System JPA Mongo DB
49 www.ExigenServices.com
50. Event Stores – pros and cons
JPA Event Store
Mongo DB, File system
Transactional but slow
There is no ACID support
better performance
50 www.ExigenServices.com