feat: DLQ redrive tooling (ADR-0026)#8
Merged
Merged
Conversation
…R-0026) Redrive(ctx, transport, dlq, opts): reads dead-lettered messages, resets each (strip dead_letter, attempts->0, preserve job/trace_id/data/meta) and re-publishes to its dead_letter.original_queue or a chosen ToQueue. Options: ToQueue (sandbox replay), Max, DryRun (inspect+restore), Select (filter). Drains-then-processes; acks a DLQ message only after a successful re-publish; restores undecodable bodies. Pure transport+codec, no new dependency. Replay-Bypass header is a documented phase two.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The operator tool the error-handling contract explicitly deferred: "Re-driving messages from the DLQ back to the source queue is an operator/tooling concern for v1." Implements ADR-0026.
What
Redrive(ctx, transport, dlq, opts)— reads dead-lettered messages off a DLQ and re-publishes each to itsdead_letter.original_queue(oropts.ToQueue), reset for reprocessing: thedead_letterblock is stripped andattemptsreset to 0, whilejob,trace_id,dataandmetaare preserved verbatim.ToQueue— sandbox/redirect replay (the v1 safe-replay answer).DryRun— inspect and report the plan; every message is restored unchanged.Select— pick which messages to redrive (by reason, URN, …).Max— cap how many are pulled.Drains-then-processes so restored messages aren't re-encountered; acks a DLQ message only after a successful re-publish; restores undecodable bodies rather than dropping them. Built on the existing
Transport+ codec — no new dependency, and the envelope stays frozen (GR-1).Tests
8 tests via
InMemoryTransport(to-source, sandbox, dry-run, select, max, publish-failure-restores, no-dead_letter fallback, undecodable restored). Coverage 93%,-raceclean.Follow-up
The Replay-Bypass guard (a
bq-replay-bypasstransport header surfaced to handlers so a replay can skip external side-effects) is a documented phase two — it touches the runtime + every transport, like ADR-0025'straceparentfollow-up.🤖 Generated with Claude Code