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.
1. Find the observer
Section titled “1. Find the observer”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:
cratis chronicle observers list --type projectionUse -q to get just the ids if you want to script it:
cratis chronicle observers list --type projection -q2. Replay it
Section titled “2. Replay it”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:
cratis chronicle observers replay <OBSERVER_ID> --yes3. Watch it catch up
Section titled “3. Watch it catch up”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:
cratis chronicle diagnose --watchOr check the observer’s sequence position directly:
cratis chronicle observers show <OBSERVER_ID>Done when
Section titled “Done when”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.