Upload
eric-de-carufel
View
838
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
CQRS + EVENT SOURCING
Design to build a bullet proof architecture
© Pyxis Technologies inc.
/studio
Expertise
Quality
Respect
Agile Big Data custom CQRS Desktop Event
Sourcing Microsoft .NET
C# Scrum Software development Training
Web
we a
re
© Pyxis Technologies inc. 3
SPLIT COMMAND AND REQUEST
© Pyxis Technologies inc. 4
TRADITIONAL SYSTEM
User interface
Relational database
Business logic
CRUD
Data updates
© Pyxis Technologies inc.
PROBLEMS
5
© Pyxis Technologies inc. 7
WHY ARE WE STILL DOING THIS?
© Pyxis Technologies inc.
WHY ARE WE STILL DOING THIS?
8
© Pyxis Technologies inc. 10
LEAP OF FAITH…
© Pyxis Technologies inc. 11
SPLIT COMMAND AND QUERY
User interface
Relational database
Business logic
RequestsCommands
Data updates
TRADITIONAL SYSTEM
© Pyxis Technologies inc. 12
CQRS - C O M M A N D A N D Q U E RY R E S P O N S I B I L I T Y S E G R E G AT I O N
User interface
Read model
Command handlers
Requests
Relational database
Commands
Domain
Data updates
© Pyxis Technologies inc. 13
Use verbs instead of nouns Ask yourself how the user will use your system Talk in domain language
No simple data editing, more domain actionsSubmit commands
Serializable message Imperative mode Well defined language
Can a command be refused?
CALL TO ACTION
© Pyxis Technologies inc.
Commands Change system state Asynchronous (for better or worst)
Requests No system state change Denormalized model Distributable (Charding) Scalable At least 90% of system access Performance
14
CQRS
© Pyxis Technologies inc. 15
ARE WE THERE YET?
© Pyxis Technologies inc. 16
CQRS - C O M M A N D A N D Q U E RY R E S P O N S I B I L I T Y S E G R E G AT I O N
User interface
Read model
Command handlers
Requests
Relational database
Commands
Domain
Data updates
© Pyxis Technologies inc. 17
CQRS + EVENT SOURCINGSQL
Domain
User interface
Event Store
Read model
Command handlers
Event h
andle
rs
Denorm
alize
r
Service BUS
Events
XML
HTML
RequestsCommands
© Pyxis Technologies inc. 18
Model based on behavior not structureSequential and cumulativeEvents can be played backAppend onlyAny data structure can be built from eventsAudit
EVENT SOURCING
© Pyxis Technologies inc.
Rolling Snapshot Optimization
Aggregate root Transaction scope Built from events Commands
ApplyEvent
Events Can’t fail No business logic
19
EVENTS
© Pyxis Technologies inc. 20
CQRS PIPELINE
User interface Commands Domain changes Events Denormalizer
Event store
Read models
© Pyxis Technologies inc. 21
Remember Events are the only truth Domain is the heart of the system Read models are flexible and volatile
Questions?Eric De Carufel
[email protected] http://blog.decarufel.net http://pyxis-tech.com
THE END