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

Domain Driven Design with CQRS and Event Sourcing

Domain Driven Design with CQRS and Event Sourcing

Domain Driven Design, CQRS and Event Sourcing presentation made during Node.js Paris meetup (https://www.meetup.com/fr-FR/Nodejs-Paris/events/263358579/)

[email protected]

January 08, 2020
Tweet

Other Decks in Programming

Transcript

  1. View Slide


  2. View Slide

  3. View Slide

  4. View Slide

  5. !
    if(this.authProvider.validate(token)) {
    this.service
    .send(session.get("user_basket"));
    }

    View Slide

  6. • ⚠

    • ℹ


    View Slide

  7. View Slide










  8. View Slide

  9. !=

    View Slide

  10. Actor
    Behavior
    Aggregate
    Event
    View
    Command

    View Slide

  11. Actor Behavior
    Aggregate Event
    Command

    View Slide

  12. View Slide

  13. View Slide

  14. View Slide






  15. • ⚠

    View Slide

  16. CQRS
    GetBalance
    Query
    Deposite
    Command
    GetAllOperation
    Query
    Withdraw
    Command
    … …
    Dispatcher
    Read
    DB
    Dispatcher
    QueryHandler CommandHandler
    Write
    DB
    Validation Plugin
    Monitoring Plugin
    Cache Plugin

    ⚠ Eventual consistency

    View Slide

  17. View Slide

  18. • What is Event Sourcing?
    • Capture all domain changes as a sequence of events (stream)
    • Every changes in the domain are represented by events
    • Events are immutable
    • Event Store will be the single point of truth
    • Useful for:
    • Auditing
    • Debug
    • Fix inconsistency
    • Description of the pattern by Martin Fowler:
    https://martinfowler.com/eaaDev/EventSourcing.html
    Event Sourcing

    View Slide













  19. View Slide

  20. CQRS & Event Sourcing
    GetBalance
    Query
    Deposite
    Command
    GetAllOperation
    Query
    Withdraw
    Command
    … …
    Dispatcher
    Read
    DB
    Dispatcher
    QueryHandler CommandHandler
    Event
    Store
    Projection Projection
    Aggregate
    State
    Events Behaviors

    View Slide

  21. View Slide













  22. View Slide

  23. View Slide


  24. View Slide