SlideShare ist ein Scribd-Unternehmen logo
1 von 146
THIRDCHANNEL @svpember
Hi.
First, A Quick Scenario
THIRDCHANNEL @svpember
Balance: $100
THIRDCHANNEL @svpember
Balance: -$100
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Richer Data History With Event
Sourcing
Steve Pember
CTO, ThirdChannel
gr8Conf US 2015
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
• Implementation (Theory)
• Implementation (For Real)
• Any Tools Available?
• Demo (Hopefully)
What Is Event Sourcing?
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
THIRDCHANNEL @svpember
Instead, Store Facts
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
Event: Something Which Has
Occurred In The System
Aggregate: The Object of Events’
Affections
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
There is No Delete
THIRDCHANNEL @svpember
Full History of the Aggregates
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
THIRDCHANNEL @svpember
• snapshot photo
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
• Transient Objects
Objects are Transient Derivatives of Your
Events
THIRDCHANNEL @svpember
Event Sourcing
• Alternative Storage Pattern
• Series of Facts
• Aggregates << Events
• Purely Additive
• Optimization: Snapshots
• Example: Shopping Cart
• Transient Objects
• Natural
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Questions So Far?
• Events & Aggregates
• Snapshots
• Additive, loss-less model
• Transient Derivatives
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
“I Think I Get What You’re Laying
Down, But It Still Seems Bananas”
So much work!
“That’s gotta be a ton of Resource overhead”
“Where’d my Models go? I can’t live without my
MVC!”
THIRDCHANNEL @svpember
Event Sourcing Challenges
• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
THIRDCHANNEL @svpember
Event Sourcing Challenges
• Additional Work To Apply
• Additional CPU Processing
• Non-Traditional Concept of Models
• More Storage Required VS non-ES
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
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
Make Use of @Transactional Code
THIRDCHANNEL @svpember
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
So Why Use ES?
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
THIRDCHANNEL @svpember
Why Event Sourcing
• More Than an Audit Log
Audit Logs Tell the History
Events Tell the Intent of History
ES is also a perfect Audit Log
THIRDCHANNEL @svpember
Why Event Sourcing
• More Than an Audit Log
• Data Storage is Inexpensive
THIRDCHANNEL @svpember
Why Event Sourcing
• More Than an Audit Log
• Data Storage is Inexpensive
• Used By All Long-Running Businesses
THIRDCHANNEL @svpember
All Business Problems Can Be Modeled With
Event Sourcing
THIRDCHANNEL @svpember
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
Remember: There Is No Delete
THIRDCHANNEL @svpember
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
Unit Test Events, Assert In Integration Tests
Time Travel Eases Debugging
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
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
Future-Proof your Data
THIRDCHANNEL @svpember
But With Event Sourcing…
–Johnny Appleseed
“Type a quote here.”
THIRDCHANNEL @svpember
Current State is a Projection
A 3C Example
THIRDCHANNEL @svpember
Still…
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Have you ever built?
• Versioning of objects
• An ‘undo’ action
• Audit Log
• Tracking object value changes over time?
• Time series?
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
THIRDCHANNEL @svpember
Querying Events
• All Queries are Projections, including Current State
THIRDCHANNEL @svpember
Querying Events
• All Queries are Projections, including Current State
• Returning Current State is Easy
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Querying Events
• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough, use a Read Model
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Querying Events
• All Queries are Projections, including Current State
• Returning Current State is Easy
• Other Projections Can Be Tough
• Try Reactive Streams
THIRDCHANNEL @svpember
Use Streams to Filter Events in Code
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
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
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
• Implementation (Theory)
THIRDCHANNEL @svpember
Implementation (Theory)
• Simple Base Objects
Three Base Objects
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Past-Tense Event Names
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Implementation (Theory)
• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Implementation (Theory)
• Simple Base Objects
• Aggregate and Event SubClasses Have Transient Properties
• Aggregates Receive and Play Events
Events Modify Aggregates
THIRDCHANNEL @svpember
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
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
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
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
• Implementation (Theory)
• Implementation (Reality)
THIRDCHANNEL @svpember
Implementation (Reality)
• Snapshot Rarely
THIRDCHANNEL @svpember
Implementation (Reality)
• Snapshot Rarely
• ‘Pure’ Event Sourcing is tough to work with
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Implementation (Reality)
• Snapshot Rarely
• ‘Pure’ Event Sourcing is tough to work with
• 2 Alternatives
THIRDCHANNEL @svpember
Sync
THIRDCHANNEL @svpember
Plus so much more (I could talk all
day about ES)
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
• Implementation (Theory)
• Implementation (For Real)
• Any Tools Available?
THIRDCHANNEL @svpember
Event Source Libraries
• No Real Need for an ORM
THIRDCHANNEL @svpember
Event Sourcing Libraries
• No Real Need for an ORM
• Akka Persistence (JVM)
THIRDCHANNEL @svpember
Persistence & Event Storage
• No Real Need for an ORM
• Akka Persistence (JVM)
• Database Agnostic
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Questions?
THIRDCHANNEL @svpember
Agenda
• Event Sourcing
• Event Sourcing Challenges
• Don’t Worry, ES Is Worth It
• Querying
• Implementation (Theory)
• Implementation (For Real)
• Any Tools Available?
• Demo?
Demo Time!
THIRDCHANNEL @svpember
In Summary
Event Sourcing -> Additive Only,
Lossless. Can Be Tricky To Work With
Not for your Mom’s Blog
Thank You!
THIRDCHANNEL @svpember
Any Questions?
Steve Pember
@svpember
www.thirdchannel.com
THIRDCHANNEL @svpember
More on Event Sourcing
• ThirdChannel Event Source Library (Java): https://github.com/RSV2/eventsource
• Demo App: https://github.com/spember/event-source-demo
• “Event Sourcing” (Martin Fowler): http://martinfowler.com/eaaDev/EventSourcing.html
• Event Store & “Event Sourcing Basics”: http://docs.geteventstore.com/introduction/event-sourcing-basics/
• Event Sourcing presentation by Greg Young: https://www.youtube.com/watch?v=JHGkaShoyNs
THIRDCHANNEL @svpember
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

Weitere ähnliche Inhalte

Ähnlich wie Gr8conf US 2015 - Intro to Event Sourcing with Groovy

introDMintroDMintroDMintroDMintroDMintroDM.ppt
introDMintroDMintroDMintroDMintroDMintroDM.pptintroDMintroDMintroDMintroDMintroDMintroDM.ppt
introDMintroDMintroDMintroDMintroDMintroDM.ppt
DEEPAK948083
 
10 -- Overfitting and Underfitting.pptx
10 -- Overfitting and Underfitting.pptx10 -- Overfitting and Underfitting.pptx
10 -- Overfitting and Underfitting.pptx
kpcp
 

Ähnlich wie Gr8conf US 2015 - Intro to Event Sourcing with Groovy (20)

Azure stream analytics by Nico Jacobs
Azure stream analytics by Nico JacobsAzure stream analytics by Nico Jacobs
Azure stream analytics by Nico Jacobs
 
Reactive Streams and the Wide World of Groovy
Reactive Streams and the Wide World of GroovyReactive Streams and the Wide World of Groovy
Reactive Streams and the Wide World of Groovy
 
Observability - the good, the bad, and the ugly
Observability - the good, the bad, and the uglyObservability - the good, the bad, and the ugly
Observability - the good, the bad, and the ugly
 
Using Time Series for Full Observability of a SaaS Platform
Using Time Series for Full Observability of a SaaS PlatformUsing Time Series for Full Observability of a SaaS Platform
Using Time Series for Full Observability of a SaaS Platform
 
Observability – the good, the bad, and the ugly
Observability – the good, the bad, and the uglyObservability – the good, the bad, and the ugly
Observability – the good, the bad, and the ugly
 
How Gousto is moving to just-in-time personalization with Snowplow
How Gousto is moving to just-in-time personalization with SnowplowHow Gousto is moving to just-in-time personalization with Snowplow
How Gousto is moving to just-in-time personalization with Snowplow
 
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, EuropePatterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
 
Process Mining and Data-Driven Process Simulation
Process Mining and Data-Driven Process SimulationProcess Mining and Data-Driven Process Simulation
Process Mining and Data-Driven Process Simulation
 
introDMintroDMintroDMintroDMintroDMintroDM.ppt
introDMintroDMintroDMintroDMintroDMintroDM.pptintroDMintroDMintroDMintroDMintroDMintroDM.ppt
introDMintroDMintroDMintroDMintroDMintroDM.ppt
 
introDM.ppt
introDM.pptintroDM.ppt
introDM.ppt
 
Using InfluxDB for Full Observability of a SaaS Platform by Aleksandr Tavgen,...
Using InfluxDB for Full Observability of a SaaS Platform by Aleksandr Tavgen,...Using InfluxDB for Full Observability of a SaaS Platform by Aleksandr Tavgen,...
Using InfluxDB for Full Observability of a SaaS Platform by Aleksandr Tavgen,...
 
10 -- Overfitting and Underfitting.pptx
10 -- Overfitting and Underfitting.pptx10 -- Overfitting and Underfitting.pptx
10 -- Overfitting and Underfitting.pptx
 
Market Basket Analysis in SQL Server Machine Learning Services
Market Basket Analysis in SQL Server Machine Learning ServicesMarket Basket Analysis in SQL Server Machine Learning Services
Market Basket Analysis in SQL Server Machine Learning Services
 
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)
 
Data Collection 2.pptx
Data Collection 2.pptxData Collection 2.pptx
Data Collection 2.pptx
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
 
Risk Management and Reliable Forecasting using Un-reliable Data (magennis) - ...
Risk Management and Reliable Forecasting using Un-reliable Data (magennis) - ...Risk Management and Reliable Forecasting using Un-reliable Data (magennis) - ...
Risk Management and Reliable Forecasting using Un-reliable Data (magennis) - ...
 
lean kanban india 2017 | Stochastic models for forecasting projects | Brett A...
lean kanban india 2017 | Stochastic models for forecasting projects | Brett A...lean kanban india 2017 | Stochastic models for forecasting projects | Brett A...
lean kanban india 2017 | Stochastic models for forecasting projects | Brett A...
 
Lean Kanban India 2016 | Stop fudging the numbers and Start Forecasting with ...
Lean Kanban India 2016 | Stop fudging the numbers and Start Forecasting with ...Lean Kanban India 2016 | Stop fudging the numbers and Start Forecasting with ...
Lean Kanban India 2016 | Stop fudging the numbers and Start Forecasting with ...
 
5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events5 Amazing Reasons DBAs Need to Love Extended Events
5 Amazing Reasons DBAs Need to Love Extended Events
 

Mehr von Steve Pember

Surviving in a Microservices Environment
Surviving in a Microservices EnvironmentSurviving in a Microservices Environment
Surviving in a Microservices Environment
Steve Pember
 
An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVMAn Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Steve Pember
 
Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015
Steve Pember
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and Grails
Steve Pember
 

Mehr von Steve Pember (20)

Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
SACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices EnvironmentSACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices Environment
 
Surviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridgedSurviving in a Microservices environment -abridged
Surviving in a Microservices environment -abridged
 
Gradle Show and Tell
Gradle Show and TellGradle Show and Tell
Gradle Show and Tell
 
Greach 2018: Surviving Microservices
Greach 2018: Surviving MicroservicesGreach 2018: Surviving Microservices
Greach 2018: Surviving Microservices
 
Reactive All the Way Down the Stack
Reactive All the Way Down the StackReactive All the Way Down the Stack
Reactive All the Way Down the Stack
 
Event storage in a distributed system
Event storage in a distributed systemEvent storage in a distributed system
Event storage in a distributed system
 
Harnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with GroovyHarnessing Spark and Cassandra with Groovy
Harnessing Spark and Cassandra with Groovy
 
Surviving in a microservices environment
Surviving in a microservices environmentSurviving in a microservices environment
Surviving in a microservices environment
 
Surviving in a Microservices Environment
Surviving in a Microservices EnvironmentSurviving in a Microservices Environment
Surviving in a Microservices Environment
 
Reactive Streams and the Wide World of Groovy
Reactive Streams and the Wide World of GroovyReactive Streams and the Wide World of Groovy
Reactive Streams and the Wide World of Groovy
 
An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVMAn Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
 
Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015Richer Data History with Event Sourcing (SpringOne 2GX 2015
Richer Data History with Event Sourcing (SpringOne 2GX 2015
 
Springone2gx 2015 Reactive Options for Groovy
Springone2gx 2015  Reactive Options for GroovySpringone2gx 2015  Reactive Options for Groovy
Springone2gx 2015 Reactive Options for Groovy
 
Gr8conf US 2015: Reactive Options for Groovy
Gr8conf US 2015: Reactive Options for GroovyGr8conf US 2015: Reactive Options for Groovy
Gr8conf US 2015: Reactive Options for Groovy
 
Groovy Options for Reactive Applications - Greach 2015
Groovy Options for Reactive Applications - Greach 2015Groovy Options for Reactive Applications - Greach 2015
Groovy Options for Reactive Applications - Greach 2015
 
Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015Advanced Microservices - Greach 2015
Advanced Microservices - Greach 2015
 
Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)Managing a Microservices Development Team (And advanced Microservice concerns)
Managing a Microservices Development Team (And advanced Microservice concerns)
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and Grails
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
 

Kürzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Gr8conf US 2015 - Intro to Event Sourcing with Groovy

Hinweis der Redaktion

  1. Before I begin, I just want to run through a quick scenario with you all
  2. Picture your bank in your mind. For many of us, this may not exactly be a happy thought. There’s likely several brick and mortar branches for your particular bank in the area. However, being tech folks, I don’t suppose it’s a stretch to surmise that you all primarily interact with your bank via their website, yes?
  3. Imagine you went to your bank’s wonderful website, entered your information, and logged in successfully. I hope no one works for farmers. I typed in “Bank website” into google, and this was the first result.
  4. And, upon logging in, you click the link to check your balance. In doing so, you’re presented with a screen that just shows you “Balance, $100”, but with no context around that number. This may be fine if you expected there to be $100…
  5. But what if the balance was negative and you weren’t expecting that? What happened to the christmas check from grandma that should have cleared by now?
  6. What if that’s all your bank balance was, just a simple number? What if that was all your bank could tell you? What if your balance was simply a column in a row in a database somewhere? … and What if you didn’t agree?
  7. How angry would you be? Can you imagine the arguments you’d have with the teller or an agent over the phone, trying to figure out if your latest pay check was deposited?
  8. Luckily, that’s not how things are done. Banks store your account’s entire history. Every transaction you make with your bank. Every Credit or Debit made is logged, along with an audit trail of who (e.g. which teller) made the change. To get your balance, your bank simply adds up each of these transactions May also periodically record what the balance was at specific points in time, to prevent having to recalculate everything from the beginning of time.
  9. There’s a certain advantage to this idea, that we can record all modifications to our data - in this case, the credits and the debits - as EVENTS that occur within our system. For example, Your bank is able to tell you exactly how they arrived at your account balance.
  10. -What about your company’s software? -Can you tell your users or internal business analysts how you are arriving at the data your application presents to them? … -Today I’m going to present a method called Event Sourcing that does just… that and how it can fuel the competitiveness of your company.
  11. Bold, right? With that, this is ‘Richer Data History with Event Sourcing’. My name is Steve, and I work for a startup called ThirdChannel, which is located in Boston
  12. Today I’d like to go over the following topics: -Event Sourcing at a high level, -Challenges - Querying: “How do I query this mess?”
  13. Let’s begin
  14. Or rather, it’s alternative to your standard ORM storage mapping, Where an object in memory maps directly to a row in a database, even if that row may be split via joins * update is made to a model, updates a column in your database * in this method, the only thing you know about your data is what it looks like right now.
  15. Event Sourcing says “that’s fine, but we’re going to something a bit different”. Instead of storing the current state of our models, we’re going to store facts about our models
  16. Every successful user interaction generates a series of facts or ‘events’ within our system
  17. This stream of events are persisted in our database in the order they occurred, as a journal of what has transpired. These events can then be played back against our Domain Object, building it up to the state it would be at any given point in time, although this is most likely the Current State A stream of events represent a particular object in Aggregate
  18. Which means I should talk about the two main concepts behind Event Sourcing
  19. An Event Represents something that has occurred within your system. The past tense is important when describing them. It represents an intentional user action or result of user action that almost always results in the manipulation or state change or an Object. Things like “BankAccountOpened”, “CurrencyDeposited” are decent names for events
  20. The objects which are affected by Events are referred to as an Aggregate. They generally serve as a root for a stream of events; they represent the state of an event stream ‘in aggregate’. Akin to a domain model. It doesn’t have to be, though. It can be, say, relationships between objects. For example, at ThirdChannel we model the assignment relationship between our users and what we call programs as an Aggregate. Along with many other things.
  21. Event Sourcing is a purely additive model…
  22. there are no deletes or updating of events. Events are immutable once written to our journal This is a powerful notion, if you consider the implications: using Event Sourcing, no data is ever lost or ignored. <pause>
  23. Now, When I need to retrieve information about my Aggregates, I simply play back all of the events that have occurred in the past in order to build up the data to a specific point in time, generally the current date, thus getting the current state of our data.
  24. One of the Key points: by maintaining all events, we’re able to access the current state of our aggregates (again, or objects), certainly, but we can also access the state of our data or aggregates at any point in time. Which is huge.
  25. Now, I’m sure some of you are thinking “waiiit, if I never get rid of anything, certainly that has tradeoffs, too?” Specifically, performance. What happens if I have thousands, or even millions of events I have to apply?
  26. You’re right, and that’s a great observation. Luckily, Event Sourcing recommends an early optimization known as ‘Snapshots’
  27. A Snapshot is just what you’d think it would be: a recording of the details of your Aggregate at that moment in time. Persisted forever
  28. As we consume and create events, periodically we persist a snapshot, containing the state of the aggregate at that point in time. -When replaying events, we load from the most recent snapshot, then apply only the events between when that snapshot was taken, and the targeted end date. So, in this case,… -I’ll get into some more specifics around snapshots in a bit.
  29. One of my favorite examples
  30. Suppose we were building an ecommerce app and we are building the ‘shopping’ cart feature.
  31. Naive, ORM, relational -> join table with quantity Event Sourcing -> <identify page components> are not saved as a join table or a single row.
  32. Instead, w/ ES, system stores all commands you’ve issued / replays for current state <list events> Quickly remove base from the cart, before placing the order and generating an OrderPlacedEvent View doesn’t display raw events Data backing the view is built up from events to form an Object intended for View For those of you familiar with ‘CQRS’, ES is commonly featured as part of it; I’m attempting to describe the ‘Read’ component. Object is Transient -> object will be garbage collected and no direct representation exists on disk
  33. That brings up the next step, Working with Objects
  34. And this is where Event Sourcing will start to hurt your brain. In order to fully grasp what Event Sourcing is, it’s important to realize that…:
  35. All objects that are ‘displayed’ to the user in your View layer are simply transient derivatives of your event stream. They are ephemeral and must be built up from the events to be used in a traditional manner within your application
  36. Finally, I argue that structuring our data in this way is akin to the way our brains work; it’s natural.
  37. Internally, your mind is able to tell you the current state of your knowledge about things. This current state is formed by a series of observations / facts / events in your past. You’re able to replay these events in your mind, and also remember your knowledge at that point in time. Our minds aren’t perfect, though, and sometimes we violate the ES rules by deleting Events. Ooops.
  38. Let’s take me as an Example. Even if you’ve never seen or met me before today, your mind has already recorded a series of facts which is driving your mental model of me. For example: FeatureObservedEvent ActionObservedEvent -Now, if I were to suddenly make a rude gesture at the audience…
  39. that would apply a new event to your mental model. Your current state opinion of me would likely be negative although you could remember a time before you thought negatively of me. “Man, Steve seemed like an alright guy until he flipped off the audience. What a jerk”
  40. That, I think, is the basis for what Event Sourcing is. It may be a bit early, but are there any questions so far?
  41. Then Let’s move on to the next section, Challenges or Difficulties with ES. Or as I like to call it…
  42. Right now, you may be suspicious. You may be thinking:
  43. “I mean, what you’re describing sounds like a ton of extra work to implement.”
  44. -Not to mention a ton of overhead in processing these events, even if we do make good use of these snapshots you mention
  45. How can you operate in a world without Models?!
  46. And yes, that’s true. *pause* Furthermore, here’s some more bad things:
  47. Storing every event that occurs within your system will almost certainly require more storage space
  48. your database is going to start looking a bit cluttered, and you will repeatedly ask yourself why the heck you keep all this stuff around… who’s going to back and look at all those old books anyway?
  49. Now this is a truly difficult one. - Will have reduced Database Level Constraints, like Foreign Keys, null checks, unique checks, etc. - Instead, we have to rely on our software for transactions and these database constraints
  50. -This is usually where I lose the more seasoned developers. -Because our properties tend to be transients, serialized within the event, we lose things like foreign key constraints at the db level -Instead, in Event Sourcing, these checks tend to move within Transactional blocks within your code. If you’re using Grails or Spring, just slap on an @Transactional annotation
  51. Finally… ES can also be difficult for Junior Engineers I’ve noticed that people really cling to the Model View Controller way of life. - This is a very different way of building our applications, particularly for the web Recommending a different structure for the Model can make people wary. - Telling people that their Views become a “Transient object derived from the event stream” scares them
  52. As crazy as this all might sound, I argue that Event Sourcing actually has huge Benefits
  53. Next Up, “don’t worry, ES is worth it”
  54. First, Going back to the concept of a transaction or an Audit Log… Why is it that I’d want something fancy like ES, when I can audit a log file or look at my transaction log?
  55. There’s a subtle difference between an Audit Log and an Event Stream. Audit logs tell the history of what happened in your system or what was persisted to the database. Events Tell
  56. Furthermore, Having the Events as a first-order member of your platform can give you enhanced information around what your users or systems are doing beyond what might normally get written to the database. Can make events that don’t necessarily deal with the properties changed by a user, but additional actions that may have occurred And it’s easier to work with and analyze the data if the events are integrated within your platform already.
  57. Incidentally, an event object typically should have attached to it information about the user which generated the event, which also makes ES a perfect Audit Log
  58. Data storage is crazy cheap. Last I looked, AWS basic SSD storage was 0.013 per gigabyte hour/ which equates to… If you’re at the point where those pennies matter, you probably have bigger problems.
  59. next. What I find interesting is that Event Sourcing, or a non-digital analogue of it, is used by every ‘mature’, or long running business.
  60. Just Like I went over in the beginning, banks and accounting methods operate with Event Sourcing Bankers additionally even use snapshots of your balance in an additional column beyond credits and debits
  61. Lawyers! If a contract needs to be adjusted, is the contract thrown out and re-written? No. Rather, ‘addendums’ are placed on the contract. To figure out the contract actually involves, one has to read the initial contract, and then each successful addendum in order to figure out what the thing actually says.
  62. In addition, all business problems can be successfully modeled with - and benefit greatly by - event sourcing
  63. How many of you all have delete statements in your code? Even if you don’t, every time you update a row in a database and overwrite some column, you’ve just lost information
  64. Remember: there is no delete, ES is the only structural model which does not lose information.
  65. Event Sourcing simplifies Testing and Debugging. A bold claim, I know.
  66. Testing is easier / simplified with ES, you unit test the events, then later you can simply assert that specific events are applied during integration testing
  67. In addition, debugging is easy, because we have the entire history of our data.
  68. We can look back through our Aggregates’ timelines <next> and examine them at any point in history.
  69. Thus I can see what the historical state of the aggregate… or all my aggregates… was at a particular point in time, along with how it reached that state and who caused those changes.
  70. ahem… I’m sure you’re all keenly aware, but 2015 is the year they visited in this movie. “Where’s my Hoverboard?!” Anyway. If we at some point note that there’s an error or discrepancy in our data…
  71. debugging or tracing the error is a snap -We can find the faulty or conflicting event, know who executed it, when they executed it, and what lead up to the bad state. And then we can emit a new event to ‘patch’ the issue
  72. If we want to get even crazier, we could go to a specific point in our data’s timeline, then fire fake events in order to simulate alternate timelines.
  73. pause This has interesting applications for, say, a.b. testing, stress, and disaster testing. If any of these past few slides reminds you of git… well, how astute. Git is like recursive event sourcing. Ever look at the reflog?
  74. Event sourcing is the ideal storage mechanism for business analysis
  75. -because Event Sourced systems do not lose data, they’re future proofed against any crazy reports that your business analysts may need in the future
  76. suppose one such analyst came to your Ecommerce / shopping cart team asking for… all shoppers who add items to their cart and then remove them within 5 minutes. They want to know who, and which products
  77. with non es, and the naive way I mentioned earlier, you might have to build some sort of tracking table, or mark additional rows with a timestamp.. I dunno. Regardless, then you deploy… and then wait for the data to gather, as users add and remove products
  78. with Event Sourcing, your write a query for that report, you deploy… and then what to do you have? If you’re thinking: all of the data, obviously… well, you’re wrong. You have MORE than everything. We can generate the report for how it would look at every point in our history.
  79. Which makes the company and your business analysts extremely happy. There’s nothing they like better than a good report.
  80. Querying over the events; presenting different Views on them, is often called a projection Perhaps the biggest advantage of ES for me. look at specific events across one stream look at specific event types across all streams I don’t have to query on properties of our domain objects… we can look for patterns in our event stream.
  81. Grabbing the Current State of an aggregate is a projection, and probably the easiest: take all events for an Aggregate, in order. There’s a good deal else to find. In our shopping cart example: find items in cart for any given date or time range find items that were removed for any given date or time range find average rate of items removed vs items purchased for any given… find average duration between items being added and then being removed for any…
  82. Model the relation between our users and the role and state within our platform Can certainly tell you All of the current FMRs or Agents which one of us made those transitions a timeline of each agent’s transition within the program applications with a long gap between entering the system and being wait listed or interviewed, to see how long a candidate waits until we contact them how long on average, an agent lasts before being fired and/or average time for agents that have quit Turnover for a date range And I can tell you that information at ANY POINT IN TIME. e.g. the average quit rate might be different now than 6 months ago, for example that’s all I could think of off the top of my head Which is amazing, right? Just from that one relation. What would happen.. if I started to correlate other event streams?
  83. <Pause> Even after this presentation, if you’re still skeptical of the benefits… and you think this is the silliest thing you’ve ever heard of
  84. ..be aware that the decision can be out of your hands. Event Sourcing is often chosen or driven by Management out of business needs, and ‘hacky’ analogues are shoehorned into an existing system AFTER the fact.
  85. I know I have
  86. And now we get to a particular hairy topic…
  87. How am I going to handle all of these events and find what I’m looking for?
  88. All queries within ES are often referred to as a Projections over the Event Stream. This includes the concept of the current state.
  89. Returning the current state of your aggregates is easy. In other words, a lookup by Id is simple.
  90. Load the aggregate or aggregates by id, load all of the events and replay the events to get back to current state Fairly easy and straightforward
  91. All queries within ES are often referred to as a Projection over the Event Stream. This includes the concept of the current state. Typically when working with relational data, we’ll either say something like “get me the object Foo with id x”, which maps well to the current state of an object.
  92. But not so much with Events, get to this in a minute, but an event is difficult to query Queries like “Find all Foos with active=true and date between 2 values” is easy in standard ‘normal’ form databases. One alternative is a read model maintain a synchronized copy of your aggregates in another table; always sync current state into it, and then query that table Analogous to a database ‘View’ I generally like to keep any data synchronization to a minimum, but this approach can be an attractive convenience for current state searches
  93. In fact, the Event Store database, that’s exactly what they do. One has to write Projections using Streams within a web interface, that then become query-able by clients.
  94. However, as you can probably see. This is fairly difficult. The development team will need to spend time writing the projections. If you have analysts on your team that are used to writing sql, well, it’s going to be much more difficult for them.
  95. Consider feeding events into additional services or tools, particularly those that are stream friendly, like Splunk or Apache Storm
  96. first let’s discuss the theoretical approaches.
  97. Pure Event Sourcing is fairly simplistic in terms of implementation
  98. There’s really only 3 base objects that you have to worry about.
  99. -First up, the Aggregate. You have the id, which should be a UUID, the current revision number, and the type (or ‘clazz’ if you’re working with java) -The current revision number is used for optimistic locking and to see how advanced our aggregate is. -The type is used by our system when we want to load the aggregate into a more meaningful class in the system, say, a SubClass of Aggregate. In our example, the ShoppingCart class would SubClass from Aggregate
  100. Next up, Event -id, revision aggregate_id, the date with time stamp, the type, the user id, and then ‘data’ -data is a serialized representation of the event type’s properties. Generally, JSON, XML, or are recommended for the storage mechanism in the data column. - this could also be a more efficient mechanism, too, like Google’s Protocol Buffers or Apache Avro
  101. All Events should be named in the past tense, as they should reflect something successful that happened in the PAST
  102. Lastly, we have Snapshot. Again, we want to serialize the properties of the aggregate at that moment in time. Next,
  103. I should be clear about what - exactly - is being serialized into those data fields. Aggregates and Events, or at least classes that implement Aggregate and Event, contain, themselves, transient properties which are generally not persisted to the database.
  104. Plain old object with explicit transient properties each has corresponding event or events
  105. The Event itself has transient properties, whose values are persisted to the database. Also, if anyone notices that I’m using JPA annotations and I earlier mentioned that this is an alternative to ORMs… appreciate the irony. This is from a small demo app.
  106. Events Modify Transient values on the Aggregate
  107. It’s almost a Visitor pattern. As Events are generated, they are applied to an Aggregate. Aggregates are built up or, in the case of loading an aggregate, building back up. Event by Event my actual aggregate class may have several properties, however, they are all transient, in the sense that they are not persisted local to the aggregate… e.g. not in the same table. When the aggregate is first created, all of these transients are at their default value, and the playback of the events will restore them to whichever point in time I want.
  108. shopping cart -> Order placement should only charge credit card the first time the event is created
  109. In addition, you’ll also need a service layer to store and load the events and aggregates
  110. it must remember to load events in order of their revision number for the correct aggregate, and initiate the event serialization and de-serialization processes
  111. And those are the basics. That’s not too bad, eh? Unfortunately… there are a few more practical considerations to go over that are a reality for any real ES system.
  112. While snapshots seem awesome, do it only rarely. Greg Young, one of the largest voices in the ES community, claims that he doesn’t snapshot an aggregate until it reaches 1000 events. You have to juggle the time cost of the additional query for the snapshot versus the processing of the small event objects.
  113. While snapshots seem awesome, do it only rarely. Greg Young, one of the largest voices in the ES community, claims that he doesn’t snapshot an aggregate until it reaches 1000 events. You have to juggle the time cost of the additional query for the snapshot versus the processing of the small event objects.
  114. I internally made this slide hard to read to emphasize the point: querying for specific properties within events is tough. See that nice blob of JSON in the data column? As an aside: We use Postgres, which I love, which has two dedicated types for working with JSON. However, I also love JOOQ and JPA, both of which can not work with those types. If anyone knows of a way to get those working with Postgres JSON, please let me know.
  115. While snapshots seem awesome, do it only rarely. Greg Young, one of the largest voices in the ES community, claims that he doesn’t snapshot an aggregate until it reaches 1000 events. You have to juggle the time cost of the additional query for the snapshot versus the processing of the small event objects.
  116. First, the ‘Synced’ pattern. This involves keeping a ‘standard’ synchronized, current state representation of your aggregates. All writes go into the Event log, and then the Domain object is updated. All queries done against the ‘standard’ Domain objects. This is a read model Downside is that you have to do an additional write in sync with your event stream, which can be a pain.
  117. Second, and my preferred pattern, is what I call the ‘Hybrid’ approach   Use multi table inheritance to give each of your aggregates their own table. Add each of the properties you’d like to index or add database level checks, like foreign keys. It doesn’t have to be all the properties. Your aggregate maintains the current state of your data at the db level Now, the advantage of this approach is that I get the benefits of both ES and standard relational. I can make use of the standard relational db querying and indexing, plus each of my aggregates is backed by the event journal
  118. I had originally built this out to enumerate many more items, but then realized that they could be grouped into distinct sections. So, next up…
  119. With the naive use case, here’s my entire schema… our at least, without Snapshot. The snapshot is very similar to aggregate, just with a data text field
  120. These are the ones I’m aware of that are in active development. NVentStore, Prooph, and Akka. Akka is interesting, in that every object you work with is persisted as an event stream, but it doesn’t explicitly call itself Akka Event Source. Of these, I’d probably recommend Akka, provided you’re on the JVM. The persistence component is available as a standalone jar
  121. When looking for a storage mechanism, there many options available to you, and, for the most part, you’ll be fine no matter which database option you choose. Now, here are some of the better options
  122. First, EventStore, the database. Highly specialized for working with events and generating projections. Written By Greg Young, who is perhaps the most well known person in the Event Sourcing community.
  123. Chiefly intended as a message broker, it also maintains a journal of all your events. I haven’t used it directly, but anytime I start talking about Event Sourcing, someone mentions Kafka. I should really check it out.
  124. And if course, you cannot go wrong with good, old fashioned Relational Databases. I would suggest consider sticking with a standard relation database, if you’re already using it Switching to something like Event Sourcing is already enough change
  125. First, I’d like to point out that we at ThirdChannel have open sourced a small library that we’re using internally for doing Event Sourcing on the JVM. written in Groovy and RxJava
  126. Event Sourcing is an additive only, lossless data storage pattern which has insanely high potential for data analysis. It is, however, tricky to work efficiently with.
  127. I wouldn’t recommend it for certain applications; say small static content information websites (e.g. a restaurant or a business’ marketing site). Nor does it make sense to apply to every domain object in a system. However, key data in your application that you use to drive your business can benefit greatly from this approach.
  128. With that, I say thank you for you coming.