Replay
You may need to reset a subscription to a specific point in time to receive messages from that point onwards. Common scenarios include:
- Data Recovery: Re-processing payloads after fixing a bug in your client logic.
- Backfilling: Loading historic data into a new database or analytics tool.
Replay from a specific point
Step 1: Identify the "Last Good" Payload ID
Establish the ID of the last payload that was successfully processed by your system.
- From your files: each file is named after its payload, so the file
p_001m4dh7t0hh8xpngcphahtex2g.jsonholds the payload with the IDp_001m4dh7t0hh8xpngcphahtex2g. - From the website: visit the Data tab for your stream on hypermass.io to find the relevant ID, e.g. based on the publication timestamp.
Note that the "last good" payload won't be replayed itself (since it was 'good') - subsequent ones will be. Always pick the payloadId before the payload you wish to process next.
Replayed payloads that are still in your folder are left as they are. Delete any you want written again before you replay.
Step 2: Replay command
Ensure that hypermass sync is running, either as a service or in a separate terminal window, then run:
hypermass replay <stream id> -p <payload id>
The command checks the payload ID with Hypermass first. A non-existant id (e.g. a typo) is refused, and nothing changes:
❌ Command rejected: Payload '<payload id>' is not known on stream '<stream id>', nothing changed
Step 3: Follow the replay
hypermass status
The stream's last payload moves forward as the replayed payloads arrive, and its status shows whether it is connected or waiting. It can take a few moments for the replay to start.
Replay everything still available
To fetch every payload the stream still holds, use earliest in place of a payload ID:
hypermass replay <stream id> -p earliest
This will replay all the payloads that are still available on the stream, be aware of the size of the files, this command may consume a lot of your allowance.