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

KanDDDinsky Berlin 2017: Let Your Domain Events Flow

KanDDDinsky Berlin 2017: Let Your Domain Events Flow

Martin Schimak

October 20, 2017
Tweet

More Decks by Martin Schimak

Other Decks in Programming

Transcript

  1. Let your domain events flow KanDDDinsky, Oct 20th, 2017, Berlin,

    Germany [email protected] [email protected] With thoughts from http://flowing.io @berndruecker | @martinschimak
  2. Bernd Rücker Consultant & Dev. Advocate 10+ years workflow Co-founder

    Camunda http://bernd-ruecker.com/ Martin Schimak Developer & Trainer, 10+ years (de-)coding domain knowledge DDDesign, TDD/BDD, EDA http://plexiti.com/ http://flowing.io/
  3. Simplified example: dash button Photo by 0xF2, available under Creative

    Commons BY-ND 2.0 license. https://www.flickr.com/photos/0xf2/29873149904/
  4. Looking into events… Checkout Payment Inventory Shipment Domain Events are

    facts that happened in the past Good Fetched Good Stored Read Model Write Model „The button blinks green if we can ship the item within 24 hours!“
  5. Peer-to-peer event flows Checkout Payment Inventory Shipment Payment received Order

    placed Goods fetched Please fetch the goods before waiting for payment Some customers can pay via invoice …
  6. Commands can decrease coupling Order Checkout Payment Inventory Shipment Order

    placed Retrieve payment Commands have an intent about what needs to happen in the future Please fetch the goods before waiting for payment Some customers can pay via invoice Payment received Retrieve payment
  7. Good API design respects responsibility boundaries Order Checkout Payment Inventory

    Shipment „A few smart god services tell anemic CRUD services what to do!” Sam Newman What is the payment service responsible for?
  8. A customer can update an expired credit card within two

    weeks before we cancel his order „
  9. Pass around state as „routing slip“ Persist state with Entity,

    Actor, … State machine How to implement a Process Manager? DIY DIY
  10. State machines solve some hard developer problems Monitoring & Operations

    Handling of time & timeouts Retry Visibility & Reporting Versioning Compensation Message correlation & deduplication Performance & scalability
  11. State machines solve some hard developer problems Monitoring & Operations

    Handling of time & timeouts Retry Visibility & Reporting Versioning Compensation Message correlation & deduplication Performance & scalability
  12. Bpmn.createProcess("order").executable() //... .sendTask().name("Retrieve payment").camundaClass(RetrievePayme .receiveTask().name("Payment received").message("PaymentReceive //... { "name": "retrieve_payment",

    "tasks": [ { "name": "Retrieve Payment", "taskReferenceName": "payment", "type": "SIMPLE", ... Do you prefer coded or graphical DSLs? * BPMN - ISO notation for modeling and executing long-running processes and flows
  13. Explicit flows help sepatrate domain and infrastructure Ports and Adapters

    Application Domain Aggregates, Domain Events, Domain Services, etc … + the flow State machine
  14. Code online: https://github.com/flowing Slides & Blog: https://bernd-ruecker.com https://plexiti.com With thoughts

    from http://flowing.io @berndruecker | @martinschimak https://www.infoq.com /articles/microservice- event-choreographies
  15. Images licensed from iStock no attribution required All icons licensed

    from Noun Project no attribution required Images licensed under Creative Commons license Photo by 0xF2, available under Creative Commons BY-ND 2.0 license. https://www.flickr.com/photos/0xf2/2987 3149904/