Durable consumer
The following is pseudocode, not a runnable SDK. It defines the persistence boundary: effects and checkpoint commit before ACK. Supply your own durable database and supported event reducer.
Store stream/history, consumer/subscription IDs, filter, generation/hash and frozen mappings. Also store dedup records, domain revisions/state, source quality and the last committed checkpoint position/token.
Processing loop
A checkpoint with no batches still advances durable state and requires ACK. A checkpoint covering several batches commits all of them together. Validate sequence for control frames as well as batches.
The quality snapshot describes the cut, not an earlier replay position. At the cut reconcile scope state using journal positions and lastPosition; an older replay notice must not overwrite newer quality state.
Deterministic recovery checks
These are concrete acceptance oracles for your implementation. Positions and entity labels are synthetic, not wire credentials.
Implement corrections against actual domain identities, not merely an increasing effect counter. A missing target does not authorize fabricating an execution.
External actions
A database transaction does not make an external trading call exactly-once. Replayed data must not automatically repeat an action. External side effects require their own idempotency and reconciliation. Whalehunt does not execute trading commands in this product.
See recovery, corrections and frames.
