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

The Dark Side of Events (EDA)

The Dark Side of Events (EDA)

Events are our industry’s near and dear. All technological conferences are full of talks on event sourcing, event driven architectures, or event driven integrations. So hey, why not make another one? …But a bit different: Let’s talk about the dark side of this pattern.

Events, as any tool, can be used productively or destructively. During the last 8 years, at Internovus, we found so many creative ways to do the latter:

* The different ways events can introduce coupling so strong, it will make the classic enterprise monolith envy
* Multiple ways of using events to introduce accidental complexity
* How to use events to turn a microservice into an architectural trojan horse; And
* Why some events, just like underwear, better be kept private

Those sights are not for the faint of heart, but fear not. You will get heuristics that will help you identify those situations, eliminate event-driven accidental complexities, and make events great again.

B90ab53ba7cf16ed1a4bb679cc6751d7?s=128

Vladik Khononov

October 16, 2020
Tweet

Transcript

  1. vladikk doit-intl.com #ndcsydney THE DARK SIDE OF EVENTS

  2. vladikk doit-intl.com #ndcsydney @vladikk vladikk.com DoiT International

  3. vladikk doit-intl.com #ndcsydney

  4. vladikk doit-intl.com #ndcsydney SOFTWARE ARCHITECTURE

  5. vladikk doit-intl.com #ndcsydney "Architecture is about the important stuff, whatever

    that is” - Ralph Johnson
  6. vladikk doit-intl.com #ndcsydney SOFTWARE SOLVES BUSINESS PROBLEMS GOOD DESIGN SUPPORTS

    THE BUSINESS
  7. vladikk doit-intl.com #ndcsydney Infrastructure Databases Architectural styles Frameworks Languages Methodologies

    Accidental Complexity
  8. vladikk doit-intl.com #ndcsydney …and it’s hard!!! GOOD DESIGN SUPPORTS THE

    BUSINESS SOFTWARE SOLVES BUSINESS PROBLEMS
  9. vladikk doit-intl.com #ndcsydney THE GOAL OF SOFTWARE ARCHITECTURE IS TO

    MANAGE COMPLEXITY!
  10. vladikk doit-intl.com #ndcsydney 1. Component level 2. System level 3.

    Implementation level Complexity Management
  11. vladikk doit-intl.com #ndcsydney Local Complexity

  12. vladikk doit-intl.com #ndcsydney Global Complexity

  13. vladikk doit-intl.com #ndcsydney Global Complexity

  14. vladikk doit-intl.com #ndcsydney ARCHITECTURE = BOUNDARIES DESIGN

  15. vladikk doit-intl.com #ndcsydney

  16. vladikk doit-intl.com #ndcsydney EVENTS AND THEIR TYPES

  17. vladikk doit-intl.com #ndcsydney EVENT: CONTRACT FOR INTEGRATING SYSTEMS

  18. vladikk doit-intl.com #ndcsydney { “type”: “presentation-started”, “timestamp”: 1556969773, “createdBy”: 12,

    “payload” : { … } }
  19. vladikk doit-intl.com #ndcsydney TYPES OF EVENTS Event Notification Event-Carried State

    Transfer Event Sourcing / Domain Event
  20. vladikk doit-intl.com #ndcsydney EVENT NOTIFICATION Something important No (direct) response

    Minimal informaAon
  21. vladikk doit-intl.com #ndcsydney EVENT NOTIFICATION

  22. vladikk doit-intl.com #ndcsydney TYPES OF EVENTS Event Notification Event-Carried State

    Transfer Event Sourcing / Domain Event
  23. vladikk doit-intl.com #ndcsydney { “customerId”: “123”, “name”: “John Johnson”, “state”:

    “approved”, … }
  24. vladikk doit-intl.com #ndcsydney TYPES OF EVENTS Event Notification Event-Carried State

    Transfer Event Sourcing / Domain Event
  25. vladikk doit-intl.com #ndcsydney EVENT SOURCING / DOMAIN EVENTS Events are

    the source of truth CombinaAon of noAficaAon and state transfer “Immutable, stateless, truthful”
  26. vladikk doit-intl.com #ndcsydney EVENT SOURCING / DOMAIN EVENTS

  27. vladikk doit-intl.com #ndcsydney TYPES OF EVENTS Notification Event:
 { “type”:

    “Marriage”, … }
 Event-Carried State Transfer { “type”: “PersonalDetailsChanged”, “newLastName”: “johnson” } Domain Event: { “type”: “GotMarried”, “partnerId”: “TZ7138821”, “assumedPartnersLastName”: true }
  28. vladikk doit-intl.com #ndcsydney STORIES OF WAR AND HORROR

  29. vladikk doit-intl.com #ndcsydney

  30. vladikk doit-intl.com #ndcsydney FROM MONOLITH TO MICROLITHS 01

  31. vladikk doit-intl.com #ndcsydney Monolith Everything

  32. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Notification Event

  33. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Notification Event Calculate

    Metrics
  34. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Notification Event Calculate

    Metrics Logical Coupling
  35. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Notification Event Calculate

    Metrics Logical Coupling Transactional Coupling
  36. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Domain Event Event

    Sourcing
  37. vladikk doit-intl.com #ndcsydney Marketing CRM BI Clients Domain Event Event

    Sourcing
  38. vladikk doit-intl.com #ndcsydney COMMANDS MASQUERADING AS EVENTS 02

  39. vladikk doit-intl.com #ndcsydney CRM Relational Database Marketing BI Clients State

  40. vladikk doit-intl.com #ndcsydney CRM Event Store Sales Agent Relational Database

    CRM Result Command
  41. vladikk doit-intl.com #ndcsydney CRM Event Store Sales Agent Execution Result

    Command Projections
  42. vladikk doit-intl.com #ndcsydney COUPLED PROJECTIONS 03

  43. vladikk doit-intl.com #ndcsydney Event Store Domain Events BI Search Indexes

    Materialized Views (UI) State Projections
  44. vladikk doit-intl.com #ndcsydney Event Store Domain Events BI Search Indexes

    Materialized Views (UI) Duplicated Logic Logical Coupling
  45. vladikk doit-intl.com #ndcsydney Event Store Many Types of Events!!! BI

    Search Indexes Materialized Views (UI) Duplicated Logic Logical Coupling Implementation Coupling
  46. vladikk doit-intl.com #ndcsydney Event Store State Change Notification BI Search

    Indexes Materialized Views (UI) Private Events Service Boundary State Projection
  47. vladikk doit-intl.com #ndcsydney ARCHITECTURAL TROJAN HORSE 04

  48. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D
  49. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D New
 Microservice
  50. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D Implementation Coupling
  51. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D Anti-Corruption Layer New
 Microservice Model Transformation Business Complexity
  52. vladikk doit-intl.com #ndcsydney DISTRIBUTED MONOLITH 05

  53. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D
  54. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D
  55. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D
  56. vladikk doit-intl.com #ndcsydney OPTIMISTIC CONSISTENCY 06

  57. vladikk doit-intl.com #ndcsydney System DB User Message Bus Backup DB

    Cached State Analysis Model Enriched From
  58. vladikk doit-intl.com #ndcsydney System DB User Message Bus Same “Transaction”

    Backup DB Cached State Analysis Model Enriched From Transactional Coupling
  59. vladikk doit-intl.com #ndcsydney System DB User Message Bus Same “Transaction”

    Backup DB Cached State Analysis Model Enriched From Transactional Coupling Transactional Coupling
  60. vladikk doit-intl.com #ndcsydney System DB User Message Bus Same “Transaction”

    Backup DB Cached State Analysis Model Enriched From Transactional Coupling Transactional Coupling Temporal Coupling
  61. vladikk doit-intl.com #ndcsydney System DB Message Bus Backup DB Cached

    State Analysis Model OUTBOX PATTERN
  62. vladikk doit-intl.com #ndcsydney LESSONS LEARNED

  63. vladikk doit-intl.com #ndcsydney BE PESSIMISTIC

  64. vladikk doit-intl.com #ndcsydney BE PESSIMISTIC System DB Backup DB Analysis

    Model Cached State
  65. vladikk doit-intl.com #ndcsydney BE PESSIMISTIC Assume that everything will fail

    Event-Driven Architecture - The “driven” part is there for a reason Ensure delivery of events no matter what
  66. vladikk doit-intl.com #ndcsydney PRIVATE / PUBLIC EVENTS Event Store BI

    Search Indexes Materialized Views (UI) State Projection
  67. vladikk doit-intl.com #ndcsydney PRIVATE / PUBLIC EVENTS Private events -

    Implementation details. Public events - Public API. Should be stable. Use public events to “compress” private events.
  68. vladikk doit-intl.com #ndcsydney EVALUATE SERVICES’ CONSISTENCY REQUIREMENTS Eventual consistency? -

    Event-Carried State Transfer Read last write? - Notification Event + API for getting up-to-date data Concurrency control? - Merge them ASAP!
  69. vladikk doit-intl.com #ndcsydney EVALUATE SERVICES’ CONSISTENCY REQUIREMENTS Eventual consistency? -

    Event-Carried State Transfer Read last write? - Notification Event + API for getting up-to-date data Concurrency control? - Merge them ASAP!
  70. vladikk doit-intl.com #ndcsydney Be pessimistic Use private and public events

    Evaluate consistency requirements LESSONS LEARNED
  71. vladikk doit-intl.com #ndcsydney WRAP UP

  72. vladikk doit-intl.com #ndcsydney Manages complexity Local complexity - complexity of

    a system’s component Global complexity - interconnectedness between components SOFTWARE ARCHITECTURE
  73. vladikk doit-intl.com #ndcsydney Notification Event - something interesting happened Event-Carried

    State Transfer - publishing changes in data Domain Events - immutable, truthful, stateless TYPES OF EVENTS
  74. vladikk doit-intl.com #ndcsydney Be pessimistic Use private and public events

    Evaluate consistency requirements LESSONS LEARNED
  75. https://bit.ly/2ptJ5fS THANK YOU! @vladikk vladikk.com https://bit.ly/31nSD9c http://careers.doit-intl.com