Skip to content

Replay a Chronicle projection with the Cratis CLI

After you change a Cratis Chronicle projection, existing read-model data may still reflect the old mapping. Replay uses the event history to rebuild that data with the updated projection. Use the Cratis CLI to start the replay, then watch the observer’s progress before relying on the rebuilt data.

Confirm the target server, event store and namespace in your context before starting. If only one partition has failed, retry that partition after fixing the cause; a full replay is not needed just to resume processing.

An observer processes events as they arrive; projections, reducers and reactors are observer types. List the projections and copy the id of the one whose read model you changed:

Terminal window
cratis chronicle observers list --type projection

Use -q to get just the ids if you want to script it:

Terminal window
cratis chronicle observers list --type projection -q
Terminal window
cratis chronicle observers replay <OBSERVER_ID>

The command asks for confirmation because replay re-processes every event the observer subscribes to. Once you have checked the target, an automated pipeline can pass --yes to skip the prompt:

Terminal window
cratis chronicle observers replay <OBSERVER_ID> --yes

A successful replay command means the replay has started, not that the read model is ready. Replay runs in the background. Watch the health view refresh while the observer catches up:

Terminal window
cratis chronicle diagnose --watch

Or check the observer’s sequence position directly:

Terminal window
cratis chronicle observers show <OBSERVER_ID>

The observer’s sequence number matches the event log tail and its read model reflects the new shape. Spot-check the rebuilt data with read-models or by reading the events it was built from.