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.

Vladik Khononov

October 16, 2020
Tweet

More Decks by Vladik Khononov

Other Decks in Programming

Transcript

  1. vladikk doit-intl.com #ndcsydney EVENT SOURCING / DOMAIN EVENTS Events are

    the source of truth CombinaAon of noAficaAon and state transfer “Immutable, stateless, truthful”
  2. 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 }
  3. vladikk doit-intl.com #ndcsydney Event Store Domain Events BI Search Indexes

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

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

    Indexes Materialized Views (UI) Private Events Service Boundary State Projection
  6. vladikk doit-intl.com #ndcsydney Microservice A Microservice B Microservice C Microservice

    D Anti-Corruption Layer New
 Microservice Model Transformation Business Complexity
  7. vladikk doit-intl.com #ndcsydney System DB User Message Bus Same “Transaction”

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

    Backup DB Cached State Analysis Model Enriched From Transactional Coupling Transactional Coupling
  9. 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
  10. 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
  11. vladikk doit-intl.com #ndcsydney PRIVATE / PUBLIC EVENTS Event Store BI

    Search Indexes Materialized Views (UI) State Projection
  12. 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.
  13. 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!
  14. 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!
  15. vladikk doit-intl.com #ndcsydney Be pessimistic Use private and public events

    Evaluate consistency requirements LESSONS LEARNED
  16. vladikk doit-intl.com #ndcsydney Manages complexity Local complexity - complexity of

    a system’s component Global complexity - interconnectedness between components SOFTWARE ARCHITECTURE
  17. 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
  18. vladikk doit-intl.com #ndcsydney Be pessimistic Use private and public events

    Evaluate consistency requirements LESSONS LEARNED