echd — Echo on Encore · E3.2 · dive
At-Least-Once
A delivered entry is a recorded debt until it is acknowledged — so a consumer can die mid-work and lose nothing, and the price is that a consumer must be idempotent.
echd speaks in the present tense over a build ladder. Every module, verb, key, and port named on this page is real; the composition into one standing platform is the vision the ladder builds.
The dive
docs/echo_mq/emq.streams.md:29-42PubSub is at-most-once: a message is handed to whoever is listening and then it is gone. If a subscriber is down, or crashes between receiving and finishing, the message is not redelivered — it was never owed in the first place. The stream tier makes the opposite promise. A delivered entry is a debt, recorded in the consumer's pending-entries list, and it is not settled until XACK. A consumer that dies between read and ack has not dropped the work; it has left it owed, and the group can collect.
That promise has a mechanism and a price. The mechanism is the pending list plus XAUTOCLAIM: entries that sit unacknowledged past an idle threshold are reassigned to a living consumer, which finishes them. The price is duplication — "at least once" can mean twice, because a consumer might crash after doing the work but before acking — so every consumer is written to be idempotent. At-least-once is not free delivery; it is a guarantee that the work is not lost, paid for with consumers that can safely repeat.
One entry's life
docs/echo_mq/emq.streams.md:29-42XACK, and the debt clears. Until then the entry is delivered but not done, so a crash between read and ack cannot silently lose it.XAUTOCLAIM transfers entries idle past a threshold to a living consumer, which finishes them. No heartbeat, no leader — the pending list plus an idle timer is the whole failover.XTRIM bounds the log by length (MAXLEN) or by mint time (MINID), so memory is a policy, not an accident. And because entry ids are millisecond-prefixed, a reader replays a window by id — history without a separate store, up to the trim horizon.Hover or focus a state to read it; click to pin. Without scripting, all three read in sequence.
The price of the promise
docs/echo_mq/emq.streams.md:29-42The pending list is what makes the guarantee real, but it is worth seeing exactly what the guarantee does and does not say. It says: no entry is lost because a consumer failed. It does not say: every entry is processed exactly once. Those are different claims, and the gap between them is the window where a consumer finishes the work and then dies before its XACK lands — from the group's view the entry is still owed, so XAUTOCLAIM will hand it to someone else, and it runs twice.
This is why at-least-once is a contract on the consumer, not only the broker. The tier promises delivery; the consumer promises idempotence — that repeating an entry is safe, whether by a natural key, a dedup set, or a conditional write. The reward for holding up that end is a system that degrades honestly: under failure it does too much, never too little, and "too much" is harmless when the work is idempotent. Retention (XTRIM) and replay by mint id round it out — the log keeps as much history as policy allows, and any window can be re-read, so recovery and audit read from the same stream the workers do.
The rule
one line to carryThe delivery rule — a delivered entry stays pending until acked, so a dropped consumer loses no work. XAUTOCLAIM rescues the pending work of the dead, XTRIM bounds the log, and any id replays — and the price of "at least once" is that a consumer must be idempotent, because at least can mean twice.
Doors
the guarantee, in depthRedis Patterns, Applied
Reliable delivery as a pattern: the pending list, claim-and-ack, idempotent consumers, and dead-letter handling.
at-least-once, paid for — idempotence as the consumer's half of the contract.
/echomqEchoMQ — the protocol, in depth
XACK, XAUTOCLAIM, XTRIM, and the id-window replay commands, with the exact retention semantics.
the pending list, command by command — how the debt is recorded and settled.
References
sources · relatedSources
- Valkey — Streamsthe pending-entries list, XAUTOCLAIM, XTRIM retention, and id-range replay
Related
- E3.2 — Streams Supersede PubSubthe module this dive turns
- the-polyglot-seamthe next move: the same delivery, in any language
- E5 — The Recordwhere deep history folds beyond the trim horizon