richer data-history-event-sourcing
TRANSCRIPT
![Page 1: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/1.jpg)
THIRDCHANNEL
Hi.
![Page 2: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/2.jpg)
First, A Quick Scenario
![Page 3: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/3.jpg)
![Page 4: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/4.jpg)
![Page 5: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/5.jpg)
THIRDCHANNEL
Balance: $100
![Page 6: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/6.jpg)
THIRDCHANNEL
Balance: -$100
![Page 7: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/7.jpg)
THIRDCHANNEL
![Page 8: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/8.jpg)
THIRDCHANNEL
![Page 9: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/9.jpg)
![Page 10: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/10.jpg)
THIRDCHANNEL
![Page 11: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/11.jpg)
THIRDCHANNEL
![Page 12: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/12.jpg)
THIRDCHANNEL
Richer Data History With Event
Sourcing
Steve Pember
CTO, ThirdChannel
![Page 13: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/13.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
• Implementation (Reality)
• Event Storage
• Querying
• Demo
![Page 14: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/14.jpg)
What Is Event Sourcing?
![Page 15: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/15.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
![Page 16: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/16.jpg)
THIRDCHANNEL
![Page 17: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/17.jpg)
Instead, Store Facts
![Page 18: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/18.jpg)
![Page 19: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/19.jpg)
THIRDCHANNEL
![Page 20: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/20.jpg)
THIRDCHANNEL
![Page 21: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/21.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
![Page 22: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/22.jpg)
Event: Something Which Has
Occurred In The System
![Page 23: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/23.jpg)
Aggregate: The Object of Events’
Affections
![Page 24: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/24.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
![Page 25: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/25.jpg)
There is No Delete
![Page 26: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/26.jpg)
THIRDCHANNEL
![Page 27: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/27.jpg)
Full History of the Aggregates
![Page 28: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/28.jpg)
THIRDCHANNEL
![Page 29: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/29.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
![Page 30: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/30.jpg)
THIRDCHANNEL
• snapshot photo
![Page 31: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/31.jpg)
THIRDCHANNEL
![Page 32: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/32.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
![Page 33: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/33.jpg)
THIRDCHANNEL
![Page 34: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/34.jpg)
THIRDCHANNEL
![Page 35: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/35.jpg)
THIRDCHANNEL
![Page 36: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/36.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
• Transient Objects
![Page 37: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/37.jpg)
![Page 38: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/38.jpg)
Objects are Transient Derivatives of Your
Events
![Page 39: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/39.jpg)
THIRDCHANNEL
Event Sourcing• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
• Transient Objects
• Natural
![Page 40: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/40.jpg)
![Page 41: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/41.jpg)
THIRDCHANNEL
![Page 42: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/42.jpg)
THIRDCHANNEL
![Page 43: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/43.jpg)
THIRDCHANNEL
Questions So Far?• Events & Aggregates
• Snapshots
• Additive, loss-less model
• Transient Derivatives
![Page 44: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/44.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
![Page 45: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/45.jpg)
“I Think I Get What You’re Laying
Down, But It Still Seems Bananas”
![Page 46: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/46.jpg)
![Page 47: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/47.jpg)
So much work!
![Page 48: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/48.jpg)
“That’s gotta be a ton of CPU overhead”
![Page 49: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/49.jpg)
“Where’d my Models go? I can’t live without my
MVC!”
![Page 50: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/50.jpg)
THIRDCHANNEL
Event Sourcing Challenges• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
![Page 51: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/51.jpg)
THIRDCHANNEL
Event Sourcing Challenges• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
• More Storage Required VS non-ES
![Page 52: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/52.jpg)
THIRDCHANNEL
![Page 53: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/53.jpg)
THIRDCHANNEL
Event Sourcing Challenges• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
• More Storage Required VS non-ES
• Reduced Database Level Constraints
![Page 54: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/54.jpg)
Make Use of Transactional Code
![Page 55: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/55.jpg)
THIRDCHANNEL
Event Sourcing Challenges• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
• More Storage Required VS non-ES
• Reduced Transactions / Database Level Constraints
• May Be Confusing For Junior Engineers
![Page 56: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/56.jpg)
THIRDCHANNEL
![Page 57: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/57.jpg)
![Page 58: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/58.jpg)
THIRDCHANNEL
![Page 59: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/59.jpg)
So Why Use ES?
![Page 60: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/60.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
![Page 61: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/61.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
![Page 62: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/62.jpg)
Audit Logs Tell the History
Events Tell the Intent of History
![Page 63: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/63.jpg)
![Page 64: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/64.jpg)
ES is also a perfect Audit Log
![Page 65: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/65.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
• Data Storage is Inexpensive
![Page 66: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/66.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
• Data Storage is Inexpensive
• Used By All Long-Running Businesses
![Page 67: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/67.jpg)
THIRDCHANNEL
![Page 68: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/68.jpg)
![Page 69: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/69.jpg)
All Business Problems Can Be Modeled With
Event Sourcing
![Page 70: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/70.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
• Data Storage is Inexpensive
• Used By All Long-Running Businesses
• Only Structural Model That Does Not Lose Information
![Page 71: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/71.jpg)
Remember: There Is No Delete
![Page 72: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/72.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
• Data Storage is Inexpensive
• Used By All Long-Running Businesses
• Only Structural Model That Does Not Lose Information
• Simplified Testing and Debugging
![Page 73: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/73.jpg)
Unit Test Events, Assert In Integration Tests
![Page 74: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/74.jpg)
Time Travel Eases Debugging
![Page 75: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/75.jpg)
THIRDCHANNEL
![Page 76: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/76.jpg)
THIRDCHANNEL
![Page 77: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/77.jpg)
THIRDCHANNEL
![Page 78: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/78.jpg)
THIRDCHANNEL
![Page 79: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/79.jpg)
THIRDCHANNEL
![Page 80: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/80.jpg)
THIRDCHANNEL
![Page 81: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/81.jpg)
THIRDCHANNEL
Why Event Sourcing• More Than an Audit Log
• Data Storage is Inexpensive
• Used By All Long-Running Businesses
• Only Structural Model That Does Not Lose Information
• Simplified Testing and Debugging
• Ideal for Business Analysis
![Page 82: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/82.jpg)
Future-Proof your Data
![Page 83: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/83.jpg)
THIRDCHANNEL
![Page 84: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/84.jpg)
![Page 85: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/85.jpg)
But With Event Sourcing…
![Page 86: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/86.jpg)
–Johnny Appleseed
“Type a quote here.”
![Page 87: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/87.jpg)
THIRDCHANNEL
![Page 88: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/88.jpg)
Current State is a Projection
![Page 89: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/89.jpg)
A 3C Example
![Page 90: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/90.jpg)
THIRDCHANNEL
![Page 91: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/91.jpg)
Still…
![Page 92: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/92.jpg)
THIRDCHANNEL
![Page 93: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/93.jpg)
THIRDCHANNEL
Have you ever built?• Versioning of objects
• An ‘undo’ action
• Audit Log
• Tracking object value changes over time?
• Time series?
![Page 94: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/94.jpg)
THIRDCHANNEL
Questions so far?
![Page 95: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/95.jpg)
Next Up: Implementation
![Page 96: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/96.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
![Page 97: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/97.jpg)
THIRDCHANNEL
Implementation (Theory)• Simple Base Objects
![Page 98: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/98.jpg)
Three Base Objects
![Page 99: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/99.jpg)
THIRDCHANNEL
![Page 100: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/100.jpg)
THIRDCHANNEL
![Page 101: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/101.jpg)
Past-Tense Event Names
![Page 102: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/102.jpg)
THIRDCHANNEL
![Page 103: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/103.jpg)
THIRDCHANNEL
Implementation (Theory)• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
![Page 104: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/104.jpg)
THIRDCHANNEL
![Page 105: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/105.jpg)
THIRDCHANNEL
![Page 106: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/106.jpg)
THIRDCHANNEL
Implementation (Theory)• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
• Aggregates Receive and Play Events
![Page 107: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/107.jpg)
Events Modify Aggregates
![Page 108: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/108.jpg)
![Page 109: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/109.jpg)
THIRDCHANNEL
Implementation (Theory)• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
• Aggregates Receive and Play Events
• Aggregates Require Distinction Between New and Historical Changes
![Page 110: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/110.jpg)
THIRDCHANNEL
![Page 111: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/111.jpg)
THIRDCHANNEL
Implementation (Theory)• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
• Aggregates Receive and Play Events
• Aggregates Require Distinction Between New and Historical Changes
• Event Service Layer Required
![Page 112: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/112.jpg)
![Page 113: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/113.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
• Implementation (Reality)
![Page 114: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/114.jpg)
THIRDCHANNEL
Implementation (Reality)• Freely Add New Transient Properties
![Page 115: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/115.jpg)
THIRDCHANNEL
Implementation (Reality)• Freely Add New Transient Properties
• Be Wary of Modifying Events
![Page 116: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/116.jpg)
THIRDCHANNEL
Implementation (Reality)• Freely Add New Transient Properties
• Be Wary of Modifying Events
• Be Wary of Removing Aggregate Transients
![Page 117: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/117.jpg)
THIRDCHANNEL
Implementation (Reality)• Freely Add New Transient Properties
• Be Wary of Modifying Events
• Be Wary of Removing Aggregate Transients
• Snapshot Rarely
![Page 118: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/118.jpg)
Plus so much more…
![Page 119: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/119.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
• Implementation (Reality)
• Persistance
![Page 120: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/120.jpg)
THIRDCHANNEL
Persistence & Event Storage• No Real Need for an ORM
![Page 121: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/121.jpg)
THIRDCHANNEL
![Page 122: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/122.jpg)
THIRDCHANNEL
Persistence & Event Storage• No Real Need for an ORM
• Try a Library
![Page 123: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/123.jpg)
THIRDCHANNEL
Event Sourcing Libraries• NEventStore (.NET)
• ProophEventStore (PHP)
• Akka Persistence (JVM)
![Page 124: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/124.jpg)
THIRDCHANNEL
Persistence & Event Storage• No Real Need for an ORM
• Try a Library
• Database Agnostic
![Page 125: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/125.jpg)
THIRDCHANNEL
![Page 126: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/126.jpg)
THIRDCHANNEL
![Page 127: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/127.jpg)
THIRDCHANNEL
![Page 128: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/128.jpg)
THIRDCHANNEL
Persistence & Event Storage• No Real Need for an ORM
• Database Agnostic
• Consider Using a Relational DB
![Page 129: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/129.jpg)
THIRDCHANNEL
Questions?
![Page 130: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/130.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
• Implementation (Reality)
• Persistance
• Querying
![Page 131: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/131.jpg)
![Page 132: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/132.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
![Page 133: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/133.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
• Returning Current State is Easy
![Page 134: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/134.jpg)
THIRDCHANNEL
![Page 135: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/135.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough
![Page 136: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/136.jpg)
Query across Event Types
![Page 137: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/137.jpg)
THIRDCHANNEL
![Page 138: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/138.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough
• Try Reactive Streams
![Page 139: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/139.jpg)
THIRDCHANNEL
![Page 140: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/140.jpg)
Use Streams to Filter Events in Code
![Page 141: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/141.jpg)
THIRDCHANNEL
![Page 142: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/142.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough
• Try Reactive Streams
• Initial Projection Work May Require Dev Time
![Page 143: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/143.jpg)
Find Someone with a Statistics
Background
![Page 144: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/144.jpg)
THIRDCHANNEL
Querying Events• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough
• Try Reactive Streams
• Initial Projection Work May Require Dev Time
• Consider Cacheable Query Layers
![Page 145: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/145.jpg)
Separate Event Storage / Querying
Services
![Page 146: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/146.jpg)
THIRDCHANNEL
![Page 147: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/147.jpg)
THIRDCHANNEL
Agenda• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Implementation (Theory)
• Implementation (Reality)
• Persistance
• Querying
• Demo Time
![Page 148: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/148.jpg)
Pray to the demo gods.
![Page 149: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/149.jpg)
THIRDCHANNEL
![Page 150: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/150.jpg)
In Summary
![Page 151: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/151.jpg)
Event Sourcing -> Additive Only,
Lossless. Can Be Tricky To Work With
![Page 152: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/152.jpg)
Not for your Mom’s Blog
![Page 153: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/153.jpg)
Thank You!
![Page 155: Richer data-history-event-sourcing](https://reader036.vdocuments.mx/reader036/viewer/2022062419/55a523cf1a28ab63018b45af/html5/thumbnails/155.jpg)
THIRDCHANNEL
Image Credits• BOA: http://marketmadhouse.com/wp-content/uploads/2014/11/BofA.jpg
• Khaaaaan: http://d1oi7t5trwfj5d.cloudfront.net/38/0d9b80ae5311e1bcc4123138165f92/file/5-things-you-might-not-know-about-star-trek-ii-wrath-of-khan-30th-anniversary.jpg
• tribbles: http://de.memory-alpha.org/wiki/Tribble
• bank ledger: http://www.iowall.net/accounting-ledger-book.html
• ORM: https://guides.codepath.com/android/ActiveAndroid-Guide
• hoarders: http://www.aetv.com/hoarders
• snapshot stream: https://geteventstore.com/
• office space bobs: http://galleryhip.com/office-space-bobs.html
• Nye, Obama, Tyson photo: http://en.wikipedia.org/wiki/Selfie
• Printing Press: http://www.directindustry.com/prod/koenig-bauer-ag/offset-printing-presses-high-volume-40462-602574.html