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

CQRS and Event Sourcing with Prooph

CQRS and Event Sourcing with Prooph

Ben Adrian Sarmiento

March 27, 2020
Tweet

More Decks by Ben Adrian Sarmiento

Other Decks in Programming

Transcript

  1. Presentation title v 1. Why? 2. What is... 2.1 CQRS?

    2.2 Event sourcing? 3. Prooph 3.1 Components 3.2 Code exploration Index
  2. Presentation title WHY CQRS+ES? Disclaimer: My use and experienced benefits

    of CQRS and event sourcing may only apply to my context. Never use CQRS without guidance from someone who has real-world experience using it.
  3. Presentation title Ben Adrian Sarmiento foodpanda engineering manager / full

    stack developer self-learned Bright (acquired), Cloud Sherpas (acquired), Carmudi (acquired)
  4. Presentation title Read + Write Command Query Responsibility Segregation User

    ▪ getByID ▪ register ▪ getAll ▪ deactivate ▪ delete ▪ promoteToRole Single model
  5. Presentation title Read Write Command Query Responsibility Segregation Bank Account

    ▪ getAccountNumber ▪ getCurrentBalance ▪ getAllOneYearOldAccounts ▪ open ▪ deposit ▪ withdraw ▪ applyInterest
  6. Presentation title ▪ You have a Document model stored in

    a MySQL server (RDBMS) ▪ Search feature launched, only need to search in Document.title and Document.content ▪ You survive by doing %needle% queries in MySQL ▪ PM asks for PDF support, content should be searchable ▪ Unstructured content but structured queries (translated titles, etc.) Document management app Single model evolved to a read/write model Document management app
  7. Presentation title ▪ I need all the items that are

    currently in the cart CRUD ▪ I need all items that were removed from the cart 5 mins before checkout Event sourcing Comparison (e-commerce app) Answers different questions, addresses different needs
  8. Presentation title ▪ ItemWasAddedToCart ▪ UserCelebratedBirthday ▪ TodoWasMarkedAsDone Objects that

    goes through significant phases ▪ Project ◦ Assignments, deliveries ▪ JIRA ticket ▪ Caterpillar Examples Event Birthday, Graduation, Monthsary