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

When Microservices met Event Sourcing

When Microservices met Event Sourcing

Talk presented at the O'Reilly Software Architecture Conference 2017 https://conferences.oreilly.com/software-architecture/sa-ny/public/schedule/detail/56806

Vinicius Gomes

April 04, 2017
Tweet

More Decks by Vinicius Gomes

Other Decks in Programming

Transcript

  1. Agenda ! The Traditional Approach ! Introduction to Event Sourcing

    ! Command Query Responsibility Segregation ! Implementing the "Event Sourced Microservices" Architecture
  2. Challenges ! Coupling ! Resilience ! Response time ! User

    intent POST /orders/8659a0d6/items/ “Add item to order”
  3. Commands ! Commands are more meaningful than HTTP methods POST

    /orders/8659a0d6/items/ AddItemToOrderCommand as opposed to
  4. Queries ! Event Store is not good for queries !

    Most applications ! A few writes ! A lot of reads
  5. CQRS ! Command Model ! Commands definitions ! Events definitions

    ! The aggregate ! Aggregate repository ! Write only API ! Query Model ! Event listeners ! Query entities ! Repositories ! Read only API
  6. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent
  7. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling
  8. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience
  9. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges
  10. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges ! Complexity ! Snapshots
  11. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges ! Complexity ! Snapshots ! Upcasting
  12. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges ! Complexity ! Snapshots ! Upcasting ! Race conditions
  13. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges ! Complexity ! Snapshots ! Upcasting ! Race conditions ! Event contracts
  14. Microservices + Event Sourcing ! Benefits ! History based queries

    ! Audit log by design ! Immutability ! User intent ! Decoupling ! Resilience ! Challenges ! Complexity ! Snapshots ! Upcasting ! Race conditions ! Event contracts ! Eventual consistency