Skip to main content

Module event

Module event 

Source
Expand description

§Event Module

Core event type for event sourcing. Events represent immutable facts about things that have happened in the system.

§Audit metadata

Every event carries an AuditMetadata value. Aggregates produce events with AuditMetadata::pending(); the CommandBus::dispatch implementation overwrites that placeholder with a validated audit struct sourced from the request CommandContext before calling EventStore::append. Stores reject events whose audit fails validation.

§Design Principles

  • Immutable: Once persisted, events cannot be changed.
  • Serializable: All events can be stored as JSON.
  • Self-describing: Events contain all metadata needed to understand them.
  • Ordered: Events have a sequence number within their aggregate.
  • Audited: Every persisted event carries who/when/where/why audit data.

Structs§

Event
Core event type representing an immutable domain event.