Delivery and durability
ArkFlow's delivery contract is at-least-once by default, with optional exactly-once effects for transactional Kafka sinks. Four mechanisms carry that contract, and they answer different questions:
| Mechanism | Question it answers |
|---|---|
| Source acknowledgement | Has the output confirmed this input? Offsets commit only after the output write. |
| WAL | If the process dies before acknowledgement, can the input be replayed? |
| Checkpoint / savepoint | Where do state and source positions restart from? |
| Exactly-once output | Can a sink commit a whole batch atomically and fence zombies? |
They compose; none of them replaces another.
At-least-once
The source is acknowledged only after the downstream output confirms the write. A crash between read and write does not silently drop a message if the source can re-deliver it. On recovery, in-flight messages may be delivered more than once, so outputs must tolerate duplicates.
- Replayable sources (Kafka, MQTT QoS ≥ 1, NATS JetStream, Pulsar) re-deliver unacknowledged messages themselves. No local WAL is required for crash safety.
- Non-replayable sources (Redis lists/pub-sub, HTTP webhook/poll, file, generate, Modbus, memory, WebSocket) discard a message once read. Enable a WAL at the input boundary or accept loss on crash.
The classification of every input is in Input delivery semantics.
WAL
The write-ahead log persists input messages (and, for object-store backends,
segments plus a manifest) so a non-replayable source can be replayed after a
crash. WAL acks advance only through the highest contiguous acknowledged
sequence; a gap holds the cursor back. A WAL-enabled input completes its durable
flush before read() returns; on ack the WAL cursor advances first, then the
native source offset commits.
The local (redb) backend protects against process crashes on one node. Losing
the node loses the local WAL. The object-store backend (s3://) survives node
loss. See WAL durability and performance.
Recovery is fail-fast: an unreadable WAL or a replay failure stops the stream from starting rather than continuing with potentially lost data.
Checkpoints and state
Stateful operators stage mutations in an execution-local journal; a mutation is committed to the state backend only after its output is acknowledged. A checkpoint seals an acknowledged cut: drained acknowledgements, source positions, per-partition watermarks, operator state, and barriers all come from the same boundary. Recovery restores state and positions before reading input, so replayed output is not double-applied.
Distributed Jobs require every planned task in the cut; a partial checkpoint is never published. See acknowledged cut and checkpoint recovery.
Exactly-once effects
A Kafka output with exactly_once: true commits each acknowledged batch as one
Kafka transaction; a read_committed consumer sees all messages or none. A
stable transactional_id fences zombie producers across restarts.
The honest boundary: a crash after the producer commits and before the
source offset commits can still replay the range. Closing that window requires
the L3 pairing — transactional_offsets: true on the input and
offset_commit_group on the output — which commits the source offset inside
the producer transaction. Even then, design sinks to be idempotent where the
business requires it. Read
Exactly-once delivery before promising exactly-once
end to end.
Choosing a configuration
| Requirement | Configuration |
|---|---|
| Tolerate duplicates; simplest operation | Replayable source; no WAL; at-least-once sink. |
| Survive process crash with a non-replayable source | Enable stream durability (local WAL). |
| Survive node loss | Object-store WAL plus a replayable source where possible. |
| No duplicate rows for a transactional Kafka downstream | exactly_once: true + stable transactional_id. |
| Close the commit/offset gap for Kafka→Kafka | Add the L3 input/output pairing. |
| Stateful job that must resume where it stopped | Checkpointing with a complete task set. |