SlideShare uma empresa Scribd logo
1 de 69
Baixar para ler offline
Event Sourcing
THE BEST, UBIQUITOUS PATTERN
YOU’VE NEVER HEARD OF
@blimpyacht
5
User: A
Balance:
427
User: B
Balance:
550
User: A
Balance:
427
User: B
Balance:
550
User: A
Balance:
427
User: B
Balance:
550
+5-5
Event Sourcing
State
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5 t(12) = 9
Event Sourcing
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(5) = 10
Event Sourcing
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(9) = 12
Event Sourcing
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
Event Sourcing
a = f ’(x)
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
Event Sourcing
+5
-4
+5
Res Gestae Divi Augusti
2ndaryPrimary
2ndaryPrimary
2ndaryPrimary
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
Event Sourcing
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(4) = 14
Event Sourcing
t(8) = 10
t(12) = 9
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(4) = 14
Event Sourcing
t(8) = 10
t(12) = 9
t’(4) = -2
t’(8) = -17
t’(12) = -22
{
_id: {
ts: 1213084687000,
taxi: "abboip"
},
loc: {
geometry: [
-122.39488,
37.75134
]
},
fare: 0,
ts: ISODate("2008-06-10T07:58:07Z")
}
{
_id: ObjectId("56a4215a46778b69e08ff8ff"),
taxi: "abboip",
start: ISODate("2008-05-17T14:51:10Z"),
route: {
type: "LineString",
coordinates: [
[ -122.39724, 37.74977 ],
[ -122.40619, 37.74896 ],
[ -122.41335, 37.74831 ],
[ -122.414, 37.75157 ],
[ -122.41438, 37.75552 ]
]
},
end: ISODate("2008-05-17T14:55:58Z")
}
Data Modeling Domain Events
Domain Objects
Accounts
Payable
Accounts
Payable
Accounts
Receivable
Accounts
Payable
Accounts
Receivable
Journal
Accounts
Payable
Accounts
Receivable
Journal
Ledger
Command Query
Responsibility
Segregation
CQRS
CRUD vs. CQRS
CRUD
CRUD vs. CQRS
WRITE
READ
CRUD vs. CQRS
CRUD equals CQRS
WRITE
READ
READ
CRUD vs. CQRS
WRITE
READ
Variant Read Models: VIEWS
READ
READ
READ
READ
WRITE
READ
Primary
READ
CRUD vs. CQRS
CRUD vs. CQRS
WRITE
READ
READ
Primary
2ndary
2ndary
Where it Gets Tricky
CRUD vs. CQRS
WRITE
READ
READ
Primary
2ndary
2ndary
CRUD vs. CQRS
WRITE
READ
READ
Primary
2ndary
2ndary
Consistent Replay
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(5) = 10 Exchange Rate
Server
10 / 0.88 = 8.82€
Consistent Replay
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
t(5) = 10 Exchange Rate
Server
10 / 0.87 = 8.70€
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
0.88
Exchange Rate
Server
Consistent Replay
Where it Gets Trickier Still
External Updates
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
Notification
Subscriber
External Updates
+4
-2
+5
+7
-4
+9
-3
-6
+2
+1
+1
-5
Notification
Subscriber
Gaining Insight
Event Sourcing + CQRS
Event Sourcing + CQRS
Event Sourcing + CQRS
Event Sourcing + CQRS
Event Sourcing + CQRS

Mais conteúdo relacionado

Destaque

Aprendiendo A Hacer Presentaciones
Aprendiendo A Hacer PresentacionesAprendiendo A Hacer Presentaciones
Aprendiendo A Hacer Presentaciones
iespare09
 
Tagli pubblico impiego proteste lavoratori
Tagli pubblico  impiego proteste lavoratoriTagli pubblico  impiego proteste lavoratori
Tagli pubblico impiego proteste lavoratori
redazione gioianet
 
Configuracion 1°e
Configuracion 1°e Configuracion 1°e
Configuracion 1°e
ferjkl
 
Diabetes Mellitus tipo 2
Diabetes Mellitus tipo 2Diabetes Mellitus tipo 2
Diabetes Mellitus tipo 2
Alonso Custodio
 

Destaque (18)

Herramientas de gestión de la influencia y la reputación on lune
Herramientas de gestión de la influencia y la reputación on luneHerramientas de gestión de la influencia y la reputación on lune
Herramientas de gestión de la influencia y la reputación on lune
 
cross company code settlement.pdf
cross company code settlement.pdfcross company code settlement.pdf
cross company code settlement.pdf
 
Ilgiornaledinapoli
IlgiornaledinapoliIlgiornaledinapoli
Ilgiornaledinapoli
 
Aprendiendo A Hacer Presentaciones
Aprendiendo A Hacer PresentacionesAprendiendo A Hacer Presentaciones
Aprendiendo A Hacer Presentaciones
 
Tagli pubblico impiego proteste lavoratori
Tagli pubblico  impiego proteste lavoratoriTagli pubblico  impiego proteste lavoratori
Tagli pubblico impiego proteste lavoratori
 
NYC utility cuts power to more households in Sandy's aftermath
NYC utility cuts power to more households in Sandy's aftermathNYC utility cuts power to more households in Sandy's aftermath
NYC utility cuts power to more households in Sandy's aftermath
 
Jessenia resume pdf
Jessenia resume  pdfJessenia resume  pdf
Jessenia resume pdf
 
Maximum Double Suites
Maximum Double SuitesMaximum Double Suites
Maximum Double Suites
 
Configuracion 1°e
Configuracion 1°e Configuracion 1°e
Configuracion 1°e
 
High School Reference
High School ReferenceHigh School Reference
High School Reference
 
Kelompok Penanggulangan Darurat Bencana Berbasis pada Masyarakat
Kelompok Penanggulangan Darurat Bencana Berbasis pada MasyarakatKelompok Penanggulangan Darurat Bencana Berbasis pada Masyarakat
Kelompok Penanggulangan Darurat Bencana Berbasis pada Masyarakat
 
Estadística y diabetes. Tarea.
Estadística y diabetes. Tarea.Estadística y diabetes. Tarea.
Estadística y diabetes. Tarea.
 
Επαναληπτική δοκιμασία, Α τάξη: Το κοχύλι
Επαναληπτική δοκιμασία, Α τάξη: Το κοχύλιΕπαναληπτική δοκιμασία, Α τάξη: Το κοχύλι
Επαναληπτική δοκιμασία, Α τάξη: Το κοχύλι
 
Transporte de hacienda, ferias ganaderas y Bienestar Animal
Transporte de hacienda,  ferias ganaderas y Bienestar AnimalTransporte de hacienda,  ferias ganaderas y Bienestar Animal
Transporte de hacienda, ferias ganaderas y Bienestar Animal
 
Organigrama actualizado
Organigrama actualizadoOrganigrama actualizado
Organigrama actualizado
 
Présentation arabe
Présentation arabe Présentation arabe
Présentation arabe
 
Insulinoterapia
InsulinoterapiaInsulinoterapia
Insulinoterapia
 
Diabetes Mellitus tipo 2
Diabetes Mellitus tipo 2Diabetes Mellitus tipo 2
Diabetes Mellitus tipo 2
 

Semelhante a Event Sourcing + CQRS

The Properties of Mathematics
The Properties of MathematicsThe Properties of Mathematics
The Properties of Mathematics
arinedge
 

Semelhante a Event Sourcing + CQRS (12)

Event sourcing
Event sourcingEvent sourcing
Event sourcing
 
Big Data Day LA 2015 - Event Sourcing: The Best Ubiquitous Pattern You've Nev...
Big Data Day LA 2015 - Event Sourcing: The Best Ubiquitous Pattern You've Nev...Big Data Day LA 2015 - Event Sourcing: The Best Ubiquitous Pattern You've Nev...
Big Data Day LA 2015 - Event Sourcing: The Best Ubiquitous Pattern You've Nev...
 
Grade 5 adding fractions mixed numbers
Grade 5 adding fractions mixed numbersGrade 5 adding fractions mixed numbers
Grade 5 adding fractions mixed numbers
 
math worsheet
math worsheetmath worsheet
math worsheet
 
01 primeras-sumas-abn
01 primeras-sumas-abn01 primeras-sumas-abn
01 primeras-sumas-abn
 
Math 5
Math 5 Math 5
Math 5
 
Number facts 1 10
Number facts 1   10Number facts 1   10
Number facts 1 10
 
Math worksheet4
Math worksheet4Math worksheet4
Math worksheet4
 
The Properties of Mathematics
The Properties of MathematicsThe Properties of Mathematics
The Properties of Mathematics
 
1 8 Properties
1 8 Properties1 8 Properties
1 8 Properties
 
2 mates
2 mates2 mates
2 mates
 
Introduction to machine learning algorithms
Introduction to machine learning algorithmsIntroduction to machine learning algorithms
Introduction to machine learning algorithms
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

Event Sourcing + CQRS