Upload
bryan-reinero
View
746
Download
0
Embed Size (px)
Citation preview
Event SourcingTHE BEST UBIQUITOUS
PATTERN YOU’VE NEVER HEARD OF
@blimpyacht
User: ABalance: 427
User: BBalance: 550
User: ABalance: 427
User: BBalance: 550
User: ABalance: 427
User: BBalance: 550
+5-5
Event Sourcing
Event Sourcing
http://www.avanscoperta.it/en/training/cqrs-event-sourcing-and-applying-domain-driven-design/
https://media.licdn.com/media/p/5/005/09f/2d8/3c9f5a5.jpg
Event Sourcing
Event Sourcing
Command Query Responsibility Segregation(CQRS)
+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
f ’(x) = A
+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
Journal
Journal
Ledger
Accounts Payable
Journal
Ledger
Accounts Payable Accounts Receivable
Journal
Ledger
Command QueryResponsibility Segregation
CQRS
CRUD vs. CQRS
CRUD
CRUD vs. CQRS
WRITE
READ
WRITE
READ
Primary
READ
CRUD vs. CQRS
WRITE Primar
y
READ
Variant Read Models: VIEWS
READREADREADREAD
WRITE
READ
Primary
READ
CRUD vs. CQRS
CRUD vs. CQRS2ndar
y
WRITE
READ 2ndary
Primary
READ
CRUD vs. CQRS2ndar
y
WRITE
READ 2ndary
Primary
READ
Where it Gets Tricky
CRUD vs. CQRS2ndar
y
WRITE
READ 2ndary
Primary
READ
CRUD vs. CQRS2ndar
y
2ndary
Primary
WRITE
READ
READ
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
Bounded Contextapplicability of the modelinternally consistent UNIFICATION
Where it Gets More Tricky
External Updates+4-2+5+7-4+9-3-6+2+1+1-5
Notification
Subscriber
http://www.webstaurantstore.com/images/products/extra_large/68717/654170.jpg
External Updates+4-2+5+7-4+9-3-6+2+1+1-5
Notification
SubscriberKafka
THANKS!{ Name: ‘Bryan Reinero’,
Title: ‘Developer Advocate’,Twitter: ‘@blimpyacht’,
Email: ‘[email protected]’ }
{"_id" : ObjectId("565f1dd8d4c6d9a90a9a16ce"),"country" : "USA","crew" : "Ed White","vehicle" : "Gemini IV","date" : "6/3/65","duration" : "0:36","purpose" : "First U.S. EVA. Used HHMU and took photos,
"minutes" : 36}{
"_id" : ObjectId("565f1dd8d4c6d9a90a9a16cf"),"country" : "USA","crew" : "Eugene Cernan","vehicle" : "Gemini IX-A","date" : "6/5/66","duration" : "2:07","purpose" : "Inadequate restraints stiff 25ft umbilical and high workloads….,"minutes" : 127
}{
"_id" : ObjectId("565f1dd8d4c6d9a90a9a16d0"),"country" : "USA","crew" : "Mike Collins","vehicle" : "Gemini X","date" : "7/19/66","duration" : "0:50","purpose" : "Standup EVA. UV photos of stars. Ended by eye”,
"minutes" : 50}
db.EVA.aggregate([ { "$match": { "crew" : /David Scott/ } }, { "$project": {
_id: 0, name: { $literal: "David Scott" }, minutes: 1, }
}, { "$group": { _id: "$name", total: { $sum: "$minutes" } } }] );{ "_id" : "David Scott", "total" : 1200 }