SlideShare uma empresa Scribd logo
1 de 106
Baixar para ler offline
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

Mais conteúdo relacionado

Semelhante 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 BehaviorDynamic Detection of Malicious Behavior
Dynamic Detection of Malicious BehaviorAshwini Almad
 
​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious Behavior​Dynamic Detection of Malicious Behavior
​Dynamic Detection of Malicious BehaviorEndgameInc
 
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
 

Semelhante 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 BehaviorDynamic 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 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

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

WHAT IF WE STORED EVENTS INSTEAD OF STATE