Event Sourcing – the what, why & how - Anita Kvamme - NDC Oslo 2024

Learn how Event Sourcing stores domain events instead of state, enabling audit logs & time travel debugging. Discover key concepts, benefits, challenges & implementation tips.

Key takeaways
  • Event Sourcing stores the complete history of domain events instead of just current state, providing an audit log and enabling time travel debugging

  • Four key building blocks:

    • Event Store (stores immutable events)
    • Command Handlers (process user actions)
    • Read Models (project events into queryable views)
    • Reactors (handle automation and integration)
  • Benefits:

    • Never loses data or historical context
    • Easier to extend with new features and event types
    • Natural fit for task-based user interfaces
    • Provides audit logging and debugging capabilities
    • Good for distributed systems and modular architectures
  • Best suited for:

    • Business domains requiring audit trails
    • Complex automation scenarios
    • Systems needing historical replay
    • Task-based interfaces rather than CRUD
    • Distributed architectures
  • Challenges:

    • Learning curve with new way of thinking
    • Eventual consistency considerations
    • Cannot modify historical events directly
    • Need to handle compensating actions for corrections
    • More complex architecture with multiple moving parts
  • Implementation tips:

    • Keep aggregates and event streams small
    • Use compensating events for corrections
    • Separate internal from external events
    • Design read models for specific UI needs
    • Consider eventual consistency requirements carefully
  • Works well with:

    • Domain-Driven Design (DDD)
    • Event Storming for modeling
    • Microservices architectures
    • Event-driven architectures
    • Task-based user interfaces