Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Event Sourcing and CQRS

Introduction to Event Sourcing and CQRS

An Introduction to Event Sourcing and CQRS presented at 11º PHPSC InCompany Meetup

Guilherme Augusto Henschel

February 17, 2018
Tweet

Other Decks in Programming

Transcript

  1. Notice ✘ this talk intent is to open your mind

    ✘ use these patterns carefully ✘ remember, there is no silver bullet
  2. “ Event Sourcing ensures that all changes to application state

    are stored as a sequence of events. — Martin Fowler
  3. AccountCreated id: 123 owner: Guilherme H. 1 DepositPerformed accountId: 123

    amount: $50 2 WithdrawalPerformed accountId: 123 amount: $20 3
  4. Pros ✘ complete log of every state change ✘ easy

    way to undo things ✘ testing, traceability and debugability ✘ business and data analysis of event streams ✘ immutability
  5. Cons ✘ complexity ✘ time to get used to ✘

    limited support from frameworks
  6. When ✘ rich object-oriented domain models ✘ critical accountability and

    debugability ✘ version control for data ✘ data can give you competitive advantage ✘ building scaleable systems based on CQRS pattern
  7. “ every method should either be a command that performs

    an action, or a query that returns data to the caller, but not both. — Bertrand Meyer
  8. References ✘ Greg Young talk - https://www.youtube.com/watch?v=JHGkaShoyNs and https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf ✘

    Johannes Seitz talk - https://ookami86.github.io/event-sourcing-in- practice/ ✘ Martin Fowler articles - https://martinfowler.com/eaaDev/ EventSourcing.html and https://martinfowler.com/bliki/CQRS.html ✘ Marco Pivetta talk - https://www.youtube.com/watch?v=8NuHNtwjync ✘ http://www.cqrs.nu/ ✘ https://speakerdeck.com/owolf/cqrs-for-great-good ✘ https://speakerdeck.com/mattketmo/cqrs-and-event-sourcing