SlideShare a Scribd company logo
1 of 8
Event
Sourcing
Gabriel Passos
Jt Agibank
Briefing “We can query an application's state to find out the
current state of the world, and this answers many
questions. However there are times when we don't just
want to see where we are, we also want to know how
we got there.”
Martin Fowler, 2005
Usual Design
● Modeling the domain entities and convert into tables, documents to store at
some database
Failures
● “Hello, what’s happening?”
○ Code : “I have a dog, a car, an apartment ...”
○ Real life: a list of event that creates a story
● Loss of information
○ You can inform only the current state
○ You don’t have the information of how you got there
○ “How many times the customer take out some product of his cart and after put it back? ”
Event Sourcing
● Queue where is stored all the events ;
● Everytime that some state entity (object) changes a new event is add to the
queue;
● Every event that goes to the event store is delivered to all interested
subscribers;
Event Sourcing
● Communication between services:
○ Write an event listener that runs whenever that event is fired. This allows
you to add new integrations/functionality, without having to modify
existing domain code.
● Register an user → User created event
E-mail Service
SMS Service
Event Sourcing
● Good Points:
○ Provides an audit log of every changes in a entity
○ Create the possibility of temporal queries (time machine :D)
○ “How many times the customer take out some product of his cart and after put it back? ”. To
figure out the answer you need to analyse the store of events
● Must take care:
○ Eventual consistency
○ There a time between the event occur, the other system receive and process the event
References
● https://martinfowler.com/eaaDev/EventSourcing.html
● http://microservices.io/patterns/data/event-sourcing.html
● https://medium.com/@gabrielqueiroz/vamos-falar-sobre-event-sourcing-
276ae66106f7
● http://eventuate.io/whyeventsourcing.html
● http://eventuate.io/whyeventdriven.html
● https://dev.to/barryosull/event-sourcing-what-it-is-and-why-its-awesome

More Related Content

Similar to Event sourcing

WSO2Con USA 2015: An Introduction to the WSO2 Analytics Platform
WSO2Con USA 2015: An Introduction to the WSO2 Analytics PlatformWSO2Con USA 2015: An Introduction to the WSO2 Analytics Platform
WSO2Con USA 2015: An Introduction to the WSO2 Analytics PlatformWSO2
 
Event & Hospitality Industry Trends for 2018 & Beyond
Event & Hospitality Industry Trends for 2018 & BeyondEvent & Hospitality Industry Trends for 2018 & Beyond
Event & Hospitality Industry Trends for 2018 & BeyondSocial Tables
 
Feature Ideation
Feature Ideation Feature Ideation
Feature Ideation FeatureByte
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaC4Media
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22ndIdo Shilon
 
Event sourcing and CQRS: Lessons from the trenches
Event sourcing and CQRS: Lessons from the trenchesEvent sourcing and CQRS: Lessons from the trenches
Event sourcing and CQRS: Lessons from the trenchesDavid Jiménez Martínez
 
Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)Ontico
 
Understanding Business APIs through statistics
Understanding Business APIs through statisticsUnderstanding Business APIs through statistics
Understanding Business APIs through statisticsWSO2
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServicesDavid Walker
 
What can media learn from game analytics
What can media learn from game analyticsWhat can media learn from game analytics
What can media learn from game analyticsOsma Ahvenlampi
 
[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming AppsWSO2
 
Geode: Much More Than a Cache
Geode: Much More Than a CacheGeode: Much More Than a Cache
Geode: Much More Than a CacheVMware Tanzu
 
1 Million Cups Presentation - Climbing Everest - BackerKit
1 Million Cups Presentation - Climbing Everest - BackerKit1 Million Cups Presentation - Climbing Everest - BackerKit
1 Million Cups Presentation - Climbing Everest - BackerKitSean Tilley
 
Brown bag eventdrivenmicroservices-cqrs
Brown bag  eventdrivenmicroservices-cqrsBrown bag  eventdrivenmicroservices-cqrs
Brown bag eventdrivenmicroservices-cqrsVikash Kodati
 
Developer Day Tech Session at QuickBooks Connect Sydney 2017
Developer Day Tech Session at QuickBooks Connect Sydney 2017Developer Day Tech Session at QuickBooks Connect Sydney 2017
Developer Day Tech Session at QuickBooks Connect Sydney 2017Intuit Developer
 
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...Nordic APIs
 

Similar to Event sourcing (20)

WSO2Con USA 2015: An Introduction to the WSO2 Analytics Platform
WSO2Con USA 2015: An Introduction to the WSO2 Analytics PlatformWSO2Con USA 2015: An Introduction to the WSO2 Analytics Platform
WSO2Con USA 2015: An Introduction to the WSO2 Analytics Platform
 
Event & Hospitality Industry Trends for 2018 & Beyond
Event & Hospitality Industry Trends for 2018 & BeyondEvent & Hospitality Industry Trends for 2018 & Beyond
Event & Hospitality Industry Trends for 2018 & Beyond
 
Feature Ideation
Feature Ideation Feature Ideation
Feature Ideation
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
More than MOPS: Wall-to-Wall Automations
More than MOPS: Wall-to-Wall AutomationsMore than MOPS: Wall-to-Wall Automations
More than MOPS: Wall-to-Wall Automations
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22nd
 
Event sourcing and CQRS: Lessons from the trenches
Event sourcing and CQRS: Lessons from the trenchesEvent sourcing and CQRS: Lessons from the trenches
Event sourcing and CQRS: Lessons from the trenches
 
Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)Logging and ranting / Vytis Valentinavičius (Lamoda)
Logging and ranting / Vytis Valentinavičius (Lamoda)
 
Understanding Business APIs through statistics
Understanding Business APIs through statisticsUnderstanding Business APIs through statistics
Understanding Business APIs through statistics
 
Patterns for Building Streaming Apps
Patterns for Building Streaming AppsPatterns for Building Streaming Apps
Patterns for Building Streaming Apps
 
Moving To MicroServices
Moving To MicroServicesMoving To MicroServices
Moving To MicroServices
 
What can media learn from game analytics
What can media learn from game analyticsWhat can media learn from game analytics
What can media learn from game analytics
 
[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps
 
Geode: Much More Than a Cache
Geode: Much More Than a CacheGeode: Much More Than a Cache
Geode: Much More Than a Cache
 
1 Million Cups Presentation - Climbing Everest - BackerKit
1 Million Cups Presentation - Climbing Everest - BackerKit1 Million Cups Presentation - Climbing Everest - BackerKit
1 Million Cups Presentation - Climbing Everest - BackerKit
 
Brown bag eventdrivenmicroservices-cqrs
Brown bag  eventdrivenmicroservices-cqrsBrown bag  eventdrivenmicroservices-cqrs
Brown bag eventdrivenmicroservices-cqrs
 
Developer Day Tech Session at QuickBooks Connect Sydney 2017
Developer Day Tech Session at QuickBooks Connect Sydney 2017Developer Day Tech Session at QuickBooks Connect Sydney 2017
Developer Day Tech Session at QuickBooks Connect Sydney 2017
 
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
How I Built Bill, the AI-Powered Chatbot That Reads Our Docs for Fun , by Tod...
 
Sensing the world with data of things
Sensing the world with  data of thingsSensing the world with  data of things
Sensing the world with data of things
 
Sensing the world with Data of Things
Sensing the world with Data of ThingsSensing the world with Data of Things
Sensing the world with Data of Things
 

More from Gabriel Passos

More from Gabriel Passos (6)

Load shedding, backpressure, cdc, hypervisor, docker
Load shedding, backpressure, cdc, hypervisor, dockerLoad shedding, backpressure, cdc, hypervisor, docker
Load shedding, backpressure, cdc, hypervisor, docker
 
Aws glue
Aws glueAws glue
Aws glue
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Hot and cold observables, overlay
Hot and cold observables, overlayHot and cold observables, overlay
Hot and cold observables, overlay
 
Ec2
Ec2Ec2
Ec2
 
Versioning rest api's
Versioning rest api'sVersioning rest api's
Versioning rest api's
 

Recently uploaded

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 FMESafe Software
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaWSO2
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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.pptxRustici Software
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
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 ModelDeepika Singh
 
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 DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
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 FMESafe Software
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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​Bhuvaneswari Subramani
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 

Recently uploaded (20)

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
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
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
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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​
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 

Event sourcing

  • 2. Briefing “We can query an application's state to find out the current state of the world, and this answers many questions. However there are times when we don't just want to see where we are, we also want to know how we got there.” Martin Fowler, 2005
  • 3. Usual Design ● Modeling the domain entities and convert into tables, documents to store at some database
  • 4. Failures ● “Hello, what’s happening?” ○ Code : “I have a dog, a car, an apartment ...” ○ Real life: a list of event that creates a story ● Loss of information ○ You can inform only the current state ○ You don’t have the information of how you got there ○ “How many times the customer take out some product of his cart and after put it back? ”
  • 5. Event Sourcing ● Queue where is stored all the events ; ● Everytime that some state entity (object) changes a new event is add to the queue; ● Every event that goes to the event store is delivered to all interested subscribers;
  • 6. Event Sourcing ● Communication between services: ○ Write an event listener that runs whenever that event is fired. This allows you to add new integrations/functionality, without having to modify existing domain code. ● Register an user → User created event E-mail Service SMS Service
  • 7. Event Sourcing ● Good Points: ○ Provides an audit log of every changes in a entity ○ Create the possibility of temporal queries (time machine :D) ○ “How many times the customer take out some product of his cart and after put it back? ”. To figure out the answer you need to analyse the store of events ● Must take care: ○ Eventual consistency ○ There a time between the event occur, the other system receive and process the event
  • 8. References ● https://martinfowler.com/eaaDev/EventSourcing.html ● http://microservices.io/patterns/data/event-sourcing.html ● https://medium.com/@gabrielqueiroz/vamos-falar-sobre-event-sourcing- 276ae66106f7 ● http://eventuate.io/whyeventsourcing.html ● http://eventuate.io/whyeventdriven.html ● https://dev.to/barryosull/event-sourcing-what-it-is-and-why-its-awesome