Messaging Patterns

Event Sourcing: Storing State as a Sequence of Events

Instead of persisting current state, store every change as an immutable event and derive state by replaying the log.

January 25, 2026
#event-sourcing#event-driven#cqrs

In event sourcing, the database is an append-only event log. Current state is a left-fold over all events for an aggregate. This gives you a complete audit trail, the ability to replay history for debugging, and a natural integration bus — other services subscribe to the same event stream. The trade-off is query complexity: you must build and maintain read-model projections.

json
{ "type": "OrderPlaced",   "orderId": "ord-1", "total": 49.99 }
{ "type": "ItemAdded",     "orderId": "ord-1", "sku": "ABC", "qty": 2 }
{ "type": "OrderShipped",  "orderId": "ord-1", "trackingId": "TRK-99" }
Event store entries for an Order

Continue reading