Replay a recorded month
This guide writes a month to disk with run --out and puts one of the written files back on a broker with replay, which needs neither the generator nor the seed the month came from. What the month holds is in the simulated OpenStack world.
Before you start
- A broker to publish onto, and a collector consuming from it. The compose stack of run a simulated month is one, with its broker on
amqp://guest:guest@127.0.0.1:5672/. tally-openstack-simulatoron your machine, or a shell at the repository root forgo run ./cmd/tally-openstack-simulator.- A directory for the month's files. Every run empties it of the four files an earlier run left there.
- The simulator command line page, which describes each of the files a run writes.
- The simulator settings page, which states that
runtakesTALLY_SIM_CLOUDandreplaytakesTALLY_SIM_AMQP_URL.
Write the month to files
Render the month into a directory. With no broker configured the run writes the files and publishes nothing, and it writes the whole month before it publishes anything, so a run interrupted halfway still leaves a complete month on disk:
shTALLY_SIM_CLOUD=os-sim tally-openstack-simulator run \ --period 2026-07 --seed 1 --out /tmp/mTake the file to replay out of the directory.
notifications.jsonlholds one line per notification,events.jsonlone canonical event per billable notification,oracle.jsonthe generator's statement of the month, andheld-back.jsonlwhat theheld-backswitch kept off the bus:shls /tmp/mtextevents.jsonl notifications.jsonl oracle.json
Replay a file
Publish a captured file. The virtual clock starts at the first line's timestamp, and the message ids are the recorded ones:
shTALLY_SIM_AMQP_URL='amqp://guest:guest@127.0.0.1:5672/' \ tally-openstack-simulator replay --in /tmp/m/notifications.jsonl --factor 744A line whose timestamp lies before the previous one is published at once, which is what lets a file that is not perfectly sorted replay whole.
Replay a held-back file at factor 0, which puts it on the bus at once:
shTALLY_SIM_AMQP_URL='amqp://guest:guest@127.0.0.1:5672/' \ tally-openstack-simulator replay --in /tmp/m/held-back.jsonl --factor 0The factor is what matters there. The replay clock starts at the first line's timestamp and the held instants are spread over the whole month, so a replay at 744 trickles the file out over an hour.
Give a
pre-existingmonth the same treatment and read its start from the file rather than from the period. Such a month replays from its earliest pre-month create, because the clock starts at the first line, and the burst a run publishes ahead of the month is paced by the lead the switch drew.
Check the result
Replay the same file a second time. The recorded message ids are the ones the first replay carried, so nothing new is stored: the batch is deduplicated at ingest and
tally_events_deduplicated_totalmoves instead oftally_events_ingested_total.Replay an empty file, one holding a line that is not JSON, and one holding a body without a timestamp.
ReadStreamreads the file before the first message goes out, so each of the three ends the replay with exit status 1 and nothing published:sh: > /tmp/empty.jsonl TALLY_SIM_AMQP_URL='amqp://guest:guest@127.0.0.1:5672/' \ tally-openstack-simulator replay --in /tmp/empty.jsonl --factor 0 echo "exit $?"textexit 1