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

EventSourcing.Live 2021 - A system with thousands of event types

EventSourcing.Live 2021 - A system with thousands of event types

In the last 10 years we have applied event sourcing and CQRS in the development of our new ERP system. We now have almost two years of production experience. During these years we have run into interesting challenges that needed to be solved. In this session we share how we built a system with many thousands of event types, with the aim of serving thousands of companies and eventually millions of users.

03dc1d993fa7d5de422c1f35d53f80e6?s=128

Michiel Overeem

October 07, 2021
Tweet

Transcript

  1. A system with thousands of event types Our work at

    AFAS Software
  2. Michiel Lead Software Architect @ AFAS Software michiel.overeem@afas.nl @michielovereem https://movereem.nl

    Overeem
  3. 500+ employees (4 locations) 12.000 customers (companies) AFAS Software 500+

    employees (4 locations)
  4. AFAS Profit

  5. Small business and accountants AFAS SB+ 500+ employees (4 locations)

  6. How do we move from Profit to SB+?

  7. Person Entity Customer Role Order Agreement party Spending limit Address

    Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit
  8. Person Entity Customer Role Order Agreement party Spending limit Address

    Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit • Functional model • Only suitable for ERP • Variability in the model • Contains 25 years of knowledge 22 25 96
  9. Person Entity Customer Role Order Agreement party Spending limit Address

    Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit Generate ERP software
  10. Person Entity Customer Role Order Agreement party Spending limit Address

    Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit
  11. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query Plain and simple CQRS & event sourcing
  12. StreamItem Aggregate StreamItem Aggregate StreamItem Aggregate Data QueryModel Object StreamItem

    Aggregate EventHandler Projector Command Event (Nr=1; Id=C) Event (Nr=1; Id=B) Event (Nr=1; Id=A) Query Event (Nr=1; Id=1) Event (Nr=1; Id=2) Event (Nr=2; Id=1) Aggregate Aggregate Aggregate StreamItem Aggregate Data QueryModel Object Data QueryModel Object EventHandler Projector Data QueryModel Object Data QueryModel Object Query Command
  13. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query 3687 11646 4915 1377 1050
  14. None
  15. Event Store stats 34.106.336 events from 3469 event types Started

    with 8 customers, currently at 91 customers 0,00 5.000.000,00 10.000.000,00 15.000.000,00 20.000.000,00 25.000.000,00 30.000.000,00 35.000.000,00 40.000.000,00 Total # of events
  16. Person Entity Customer Role Order Agreement party Spending limit Address

    Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit A change here Or here … Or here … Impact!
  17. V1.1 V1.2

  18. V1.1

  19. V1.1 V1.2

  20. V1.1 V1.2

  21. V1.1 V1.2

  22. V1.2

  23. V1.1 V1.2 This is where the magic happens…

  24. Repair/Upgrade scripts Default data Event rewrites Query StreamItem UpgradeScript Command

    Command StreamItem … Command
  25. Some additional patterns…

  26. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query StreamItem ProcessManager Event (Nr=1) Event (Nr=2) Event (Nr=3) Command EventHandler Router ProcessManagers
  27. EventHandler StreamProjector Data QueryModel Object Data QueryModel Object Data QueryModel

    Object Query StreamItem Aggregate Command Event (Nr=1) Event (Nr=2) Event (Nr=3) Data QueryModel Object EventHandler Projector Query Event (Nr=1) Event (Nr=2) Event (Nr=3) StreamProjectors
  28. Data QueryModel Object EventHandler Projector Event (Nr=1; Id=C) Event (Nr=1;

    Id=B) Event (Nr=1; Id=A) Query Event (Nr=1; Id=1) Event (Nr=1; Id=2) Event (Nr=2; Id=1) Data QueryModel Object Data QueryModel Object EventHandler Projector Data QueryModel Object Data QueryModel Object Query Cross-Projector-Joins
  29. Data QueryModel Object EventHandler Projector Event (Nr=1; Id=C) Event (Nr=1;

    Id=B) Event (Nr=1; Id=A) Query Event (Nr=1; Id=1) Event (Nr=1; Id=2) Event (Nr=2; Id=1) Data QueryModel Object EventHandler Projector Data QueryModel Object Query
  30. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query
  31. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query Direct command results
  32. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query Push notifications from projectors
  33. Data QueryModel Object EventHandler Projector Event (Nr=1; Id=C) Event (Nr=1;

    Id=B) Event (Nr=1; Id=A) Query Data QueryModel Object EventHandler Projector Data QueryModel Object Query Timers & Projectors-on-projectors
  34. Data QueryModel Object StreamItem Aggregate EventHandler Projector Command Event (Nr=1)

    Event (Nr=2) Event (Nr=3) Query StreamItem ProcessManager Event (Nr=1) Event (Nr=2) Event (Nr=3) Command EventHandler Router Parallel & low-priority event processing
  35. None
  36. Sync events

  37. michiel.overeem@afas.nl @michielovereem https://movereem.nl Low-code / Impact analysis / Upgrade process

    / Several specific patterns Person Entity Customer Role Order Agreement party Spending limit Address Organisation Entity Delivery BusinessAc tivity party Invoice BusinessAc tivity party Address Address Spending limit Spending limit Own Organisation Workarea workarea Spending limit