Two reviewers approve against the same stale aggregate version.
Detect: Optimistic concurrency rejects the later conflicting append.
Recover: Reload current state and request a new decision if the action or evidence changed.
Represent business progress as an ordered history of accepted events so state, approvals, and effects can be reconstructed and audited.
Event sourcing stores the facts that changed workflow state rather than only the latest state snapshot. Events such as EvidenceAttached, ApprovalGranted, ActionSubmitted, and ReceiptObserved form a business history. Read models derive the current view from that history and can be rebuilt when projection logic changes.
An event log is not a transcript of every model token. Choose stable domain facts with identifiers, schema versions, and ordering rules. Distinguish requested actions from confirmed effects, and store sensitive payloads through governed references where possible. Replaying events rebuilds state; it must not automatically repeat external side effects.
A proof of concept can append a few workflow facts and rebuild one projection to verify that the domain events capture meaningful transitions.
Production requires optimistic concurrency, event schema evolution, idempotent consumers, protected payload references, and separation between projections and effect execution.
Enterprise scale adds partitioning, projection lag monitoring, snapshot strategy, replay tooling, retention governance, and migrations across years of event versions.
Validates requested transitions against current aggregate state and business authorization.
Persists accepted facts with aggregate version, event identity, and schema metadata.
Build query views and dashboards from events without triggering business effects during replay.
Executes approved external actions using stable operation keys and records their observed results.
Reconstruct historical state and explain which facts supported a decision at a particular version.
flowchart LR
C["Authorized command"] --> H["Versioned command handler"]
H --> E["Append-only domain events"]
E --> P["Idempotent projections"]
P --> V["Current and historical views"]
E --> D["Live effect dispatcher"]
D --> S["External service"]
S --> R["Observed receipt event"]
R --> E
E --> B["Side-effect-free replay"]Attach requester, workflow identity, expected aggregate version, and approval references to the requested transition.
Reject commands whose preconditions or authority no longer hold against the latest accepted event version.
Atomically record the domain event and any dispatch intent using a consistent transaction or outbox boundary.
Consume events idempotently, retaining sequence positions and exposing projection freshness to readers.
Dispatch only eligible live action intents with stable keys and record submission, uncertainty, or receipt as separate facts.
Replay historical events into new projections with side effects disabled, then compare reconstructed state before switching readers.
Insurance · Illustrative enterprise scenario, not a reported customer outcome.
Illustrative architecture: An insurer must explain which claim documents and policy revisions were available when an adjuster approved a packet.
Overwriting the latest case state loses the distinction between the original decision and later evidence corrections.
Reconstruct review history while keeping payments and customer notices from repeating during replay.
The claim aggregate records evidence and approval events; projections show the current packet, while a separate dispatcher handles approved external actions.
A projection is rebuilt after a code change; it regenerates the timeline but does not resend the previously issued customer notice.
Measure reconstruction accuracy, projection lag, duplicate-consumer handling, event schema compatibility, and unresolved effect receipts rather than treating log volume as audit quality.
| Decision | Benefit | Cost |
|---|---|---|
| Complete domain history | Supports reconstruction and explanation of state changes. | Requires deliberate schema and retention governance. |
| Independent projections | Allows views to evolve without rewriting source facts. | Readers must tolerate or detect projection lag. |
| Append-only facts | Preserve the sequence of decisions and corrections. | Sensitive data deletion requires careful payload and retention design. |
Detect: Optimistic concurrency rejects the later conflicting append.
Recover: Reload current state and request a new decision if the action or evidence changed.
Detect: Event identity and stored consumer position identify the duplicate.
Recover: Skip repeated application and retain idempotent projection updates.
Record explicit domain facts and keep generated drafts as referenced artifacts.
Disable side effects during projection rebuild and separate dispatch eligibility from event consumption.
Use governed payload references with explicit access, retention, and correction policies.