• event - just indicate a change without expecting any particular response
  • command - telling some service what to do

EDA - Types

Types

Description

Pros

Cons

Event Notification

  • generic code notifies specific code by events
  • e.g. GUI elements
  • decoupling
  • inability to understand what is going on by stepping through the code

Event-Carried State Transfer

  • subscribers don’t ask for additional information after an event occurred, all necessary state is given in the events
  • subscribers copy whatever they need
  • can greatly reduce network traffic
  • better availability
  • consistency lost because of replication

Event Sourcing

  • ability to rebuild the full state of the system by a persisted log of events
  • event sourcing works with data like version control systems work with code
  • “time travel” like for debugging
  • when rebuilding the state from log, can’t replay responses of external systems unless the too a recorded
  • old event schema still has to work with newer versions of code
  • IDs that are generated during replay are probably different than before
  • asynchrony is difficult for people (but is optional, you can synchronously use event sourcing)
  • versioning (snapshots can make that easier)

conclusion: replay has to work for everything, otherwise there is no point in using event sourcing

CQRS

  • separate components for:
    • updating the system
    • reading the system