Replaying Events¶
IH-Muse allows you to replay previously recorded events from a file. This is useful for testing, simulating system behavior, or reprocessing historical data.
Using the Replayer¶
To replay events, use the replay method of the Muse client.
await muse.replay("events.bin")
use std::path::Path;
muse.replay(Path::new("events.bin")).await?;
Note: Ensure that the serialization format of the recording file matches the expected format (based on the file extension).
Command-Line Interface¶
You can also use the command-line interface (CLI) tool to replay events.
Replaying with the CLI¶
ih-muse-cli replay --input events.bin --poet-url http://localhost:8000
CLI Options¶
--input: Path to the recording file.--poet-url: URL of the Muse system endpoint (defaults tohttp://localhost:8000).
Example:
ih-muse-cli replay --input events.json --poet-url http://localhost:8000
This command will replay the events from events.json to the specified Muse system.
Handling Serialization Formats¶
The CLI tool automatically determines the serialization format based on the file extension:
.binfor Bincode serialization.jsonfor JSON serialization
Ensure your recording files have the correct extension to avoid errors during replay.