Skip to main content

Replay

Reconstruct current aggregate state by applying all events from sequence 0 (or from a snapshot).

How It Works

┌─────────────┐
│ Snapshot │ (optional optimization)
│ seq: 100 │
└──────┬──────┘


┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Event 101 │ ──► │ Event 102 │ ──► │ Event 103 │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
└───────────────────────────────────────┘


┌─────────────┐
│Current State│
│ seq: 103 │
└─────────────┘

When Replay Happens

  1. Aggregate load: Before processing a command
  2. Projector startup: Catching up on missed events
  3. Debugging: Understanding how state evolved
  4. Recovery: Rebuilding state after data loss

Replay vs Temporal Query

AspectReplayTemporal Query
TargetCurrent stateHistorical state
Events usedAll (or from snapshot)Up to timestamp/sequence
Use caseNormal operationAudit, debugging

Optimization

Snapshots avoid replaying all events by caching state at checkpoints.