SlideShare una empresa de Scribd logo
1 de 106
Descargar para leer sin conexión
WHAT IF WE STORED EVENTS
INSTEAD OF STATE?
@JefClaes - jefclaes.be
SCENARIO’S
• The user can put up a card.	

• The user can move the card to the doing section.	

• …
COMMANDS
• Put up a card.	

• Move card to doing section.	

• …
State + Behavior
Traditional systems store current state.
We have no idea what has happened in our system.
Audit logs anyone?
State Audit log
Deposit 500 € 500 €
Deposit 200 € 700 €
Withdraw 300 € 400 €
Deposit 1000 € 1400 €
Withdraw 400 € 1000 €
Withdraw 200 € 800 €
… …
Deposit 500 € Deposited 500 € 500 €
Deposit 200 € Deposited 200 € 700 €
Withdraw 300 € Withdrawn 300 € 400 €
Deposit 300 € Deposited 1000 € 1400 €
Withdraw 400 € Withdrawn 400 € 1000 €
Withdraw 200 € Withdrawn 200 € 800 €
… …
Command - Event - State
Something that happened - past tense.
Store the sequence of events that led up to the
current state, instead of the current state.
Command State
Put up a new card

“Reset Password”	

Card

“Reset Password”

“Todo”
Move card to doing
Card

“Reset Password”

“Doing”
… …
Command Event State
Put up a new card

“Reset Password”	

Card put up

“Reset Password”

“Todo”
Card

“Reset Password”

“Todo”
Move card to doing
Moved card to section

“Doing”
Card

“Reset Password”

“Doing”
… … …
thinkbeforecoding.com
An event store
EventId StreamId Type Payload MetaData
1 card/1	

 CardPutUp { … } { … }
2 card/1
MovedCard	

ToSection
{ … } { … }
3 card/1
MovedCard

ToSection	

{ … }	

 { … }
… … … …
You can’t undo the past.
Append-only.
Forever cacheable.
What about queries?
Model
Writes Reads
Write model
Writes
Write model
Writes
Read model
Reads
Write model
Writes
Read model
Reads
Events
We can build a read model 

from events committed to the write model.
Events Dispatcher Projection Read model
Events Dispatcher Projection Read model
Projection Read model
Events Dispatcher Projection Read model
Projection Read model
Projection Read model
We can build read models 

from events committed to the write model.
More than one way to look at your data.
Behavior

Search

Reporting

Views

…

Complex

Slow

Fragile

What if I mess up my read models?

What if I need to update my read models?

What if I need a new read model?
Temporal queries.
Tell me which day most work gets done.
Monday Tuesday Wednesday …
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
CardMoved
Not just for read models and queries.
Events Dispatcher Projection Read model
Projection Read model
Projection Read model
Integration
Pub-Sub
Events Dispatcher
Projection
Projection
Projection
Transaction
Events Dispatcher
Projection
Projection
Projection
Events
Projection
Projection
Projection
Events Dispatcher (Queue)
Projection (Queue)
Projection (Queue)
Projection (Queue)
When?
When you can’t afford to lose data.
Business Intelligence

Auditing

Reproducing issues

Challenging/changing business models
Decouple reads from writes
Conceptual purity

Simplicity (no monolith)

Polyglot persistance

Performance

High availability

Integration with other systems

Testing

…
No silver bullet
In conclusion
Event sourcing, for when the 

what and the when are important.
… but really, it’s a lot more than that.
Experiment!
http://neventstore.org/
http://geteventstore.com/
https://groups.google.com/forum/#!forum/dddcqrs
@gregyoung
@abdullin
@randompunter
@jonathan_oliver
@jen20
@yreynhout
@mathiasverraes
@thinkb4coding
@eulerfx
@ziobrando
@tojans
Thank you!	

@JefClaes

http://jefclaes.be

Más contenido relacionado

Similar a WHAT IF WE STORED EVENTS INSTEAD OF STATE

Event Sourcing with Kotlin, who needs frameworks!
Event Sourcing with Kotlin, who needs frameworks!Event Sourcing with Kotlin, who needs frameworks!
Event Sourcing with Kotlin, who needs frameworks!Nico Krijnen
 
Spocto a new paradigm
Spocto a new paradigmSpocto a new paradigm
Spocto a new paradigmspocto
 
Run an Easy to Use Help Desk with Spiceworks
Run an Easy to Use Help Desk with SpiceworksRun an Easy to Use Help Desk with Spiceworks
Run an Easy to Use Help Desk with SpiceworksSpiceworks
 
​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious Behavior​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious BehaviorEndgameInc
 
Dynamic Detection of Malicious Behavior
Dynamic Detection of Malicious BehaviorDynamic Detection of Malicious Behavior
Dynamic Detection of Malicious BehaviorAshwini Almad
 
Event Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeEvent Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeJulian May
 
Pycon2016- Applying Deep Learning in Information Retrieval System
Pycon2016- Applying Deep Learning in Information Retrieval SystemPycon2016- Applying Deep Learning in Information Retrieval System
Pycon2016- Applying Deep Learning in Information Retrieval SystemChih-Hao (林志豪) Lin
 
Data oriented design and c++
Data oriented design and c++Data oriented design and c++
Data oriented design and c++Mike Acton
 
Approaches to game AI overview
Approaches to game AI overviewApproaches to game AI overview
Approaches to game AI overviewIvan Dolgushin
 
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)dradilkhan87
 
Microservices Coordination using Saga
Microservices Coordination using SagaMicroservices Coordination using Saga
Microservices Coordination using SagaEran Levy
 
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...Data Con LA
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsIgnacio Martín
 
JOSA TechTalks - Word Embedding and Word2Vec Explained
JOSA TechTalks - Word Embedding and Word2Vec ExplainedJOSA TechTalks - Word Embedding and Word2Vec Explained
JOSA TechTalks - Word Embedding and Word2Vec ExplainedJordan Open Source Association
 

Similar a WHAT IF WE STORED EVENTS INSTEAD OF STATE (16)

Event Sourcing with Kotlin, who needs frameworks!
Event Sourcing with Kotlin, who needs frameworks!Event Sourcing with Kotlin, who needs frameworks!
Event Sourcing with Kotlin, who needs frameworks!
 
Spocto a new paradigm
Spocto a new paradigmSpocto a new paradigm
Spocto a new paradigm
 
Run an Easy to Use Help Desk with Spiceworks
Run an Easy to Use Help Desk with SpiceworksRun an Easy to Use Help Desk with Spiceworks
Run an Easy to Use Help Desk with Spiceworks
 
Intelligent Systems for Process Mining
Intelligent Systems for Process MiningIntelligent Systems for Process Mining
Intelligent Systems for Process Mining
 
​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious Behavior​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious Behavior
 
Dynamic Detection of Malicious Behavior
Dynamic Detection of Malicious BehaviorDynamic Detection of Malicious Behavior
Dynamic Detection of Malicious Behavior
 
Event Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit holeEvent Sourcing & CQRS: Down the rabbit hole
Event Sourcing & CQRS: Down the rabbit hole
 
Pycon2016- Applying Deep Learning in Information Retrieval System
Pycon2016- Applying Deep Learning in Information Retrieval SystemPycon2016- Applying Deep Learning in Information Retrieval System
Pycon2016- Applying Deep Learning in Information Retrieval System
 
Data oriented design and c++
Data oriented design and c++Data oriented design and c++
Data oriented design and c++
 
Approaches to game AI overview
Approaches to game AI overviewApproaches to game AI overview
Approaches to game AI overview
 
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)
Introduction to Data Mining (Why Mine Data? Commercial Viewpoint)
 
Microservices Coordination using Saga
Microservices Coordination using SagaMicroservices Coordination using Saga
Microservices Coordination using Saga
 
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...
Leveraging Large Scale Datasets to Make the Most of In-game Decisions by Dyla...
 
Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016Evan Schultz - Angular Summit - 2016
Evan Schultz - Angular Summit - 2016
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
 
JOSA TechTalks - Word Embedding and Word2Vec Explained
JOSA TechTalks - Word Embedding and Word2Vec ExplainedJOSA TechTalks - Word Embedding and Word2Vec Explained
JOSA TechTalks - Word Embedding and Word2Vec Explained
 

Último

Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 

Último (20)

Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 

WHAT IF WE STORED EVENTS INSTEAD OF STATE