Skip to content

Inspect Chronicle Read Model Snapshots

Chronicle read model snapshots reconstruct how one instance reached its state by replaying events grouped by correlation ID, the identifier linking them to an operation. Use them to investigate an unexpected projection result: each snapshot puts the resulting state beside the events that produced it.

GetSnapshotsById returns reconstructed projection states, not saved copies of earlier database rows. Reducer-backed models return an empty history because the server does not run their client-side fold. For reducers, test that fold with a read-model scenario.

Each snapshot represents the cumulative read model state after one correlation group. A correlation ID ties related events to an operation, such as a command or import batch. It is not proof that those events formed a database transaction; the grouping depends on the IDs recorded with the events.

Every snapshot includes:

Field Meaning
Read model The read model state after that correlation group was applied
Events The events that were applied for that group
Occurred The timestamp of the first event in the group
Correlation ID The identifier that ties the related events together

The read model type must be registered. Pass the read model instance’s key, which is not necessarily the event source ID if the projection uses a custom key.

var snapshots = await eventStore.ReadModels.GetSnapshotsById<Order>(orderId);
Console.WriteLine($"Found {snapshots.Count()} snapshots.");

View C# snippet source on GitHub

Inspect the correlation ID, event count, timestamp, and resulting state together to find the group where the value changed:

var snapshots = await eventStore.ReadModels.GetSnapshotsById<Order>(orderId);
foreach (var snapshot in snapshots)
{
Console.WriteLine($"Snapshot at {snapshot.Occurred}:");
Console.WriteLine($" Correlation ID: {snapshot.CorrelationId}");
Console.WriteLine($" Event count: {snapshot.Events.Count()}");
Console.WriteLine($" State: {snapshot.Instance}");
}

View C# snippet source on GitHub

If you need to compare two states, materialize the snapshot list and compare neighboring entries. Chronicle gives you the timeline; your diagnostic tool decides which properties matter.

Snapshot retrieval reads the relevant history and replays the projection through each correlation group. Long histories cost more to reconstruct; a custom projection key can also require reading the event sequence before selecting the events for that key.

Use snapshots for diagnosis, not as the normal read path for a list or frequently requested value. A snapshot explains the state produced by replaying recorded events through the registered projection. It does not establish an access audit trail or recover every earlier version of the projection’s logic.

If you only need the latest value, read a single instance. For a page of stored instances without replay, use materialized reads.