feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3
Merged
Conversation
The Python mirror of babelqueue-go redrive: redrive(transport, dlq, *, to_queue, max, dry_run, select) reads dead-lettered messages off a DLQ and re-publishes each to its dead_letter.original_queue or to_queue, reset (strip dead_letter, attempts->0, preserve job/trace_id/data/meta). Drains-then-processes; acks only after a successful re-publish; restores undecodable bodies and on publish failure. Pure codec+transport, no new dependency; envelope frozen. 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 Python mirror of
babelqueue-goRedrive(ADR-0026): the operator tool for replaying off the dead-letter queue.What
redrive(transport, dlq, *, to_queue=None, max=0, dry_run=False, select=None, timeout=1.0)— reads dead-lettered messages off a DLQ and re-publishes each to itsdead_letter.original_queue(orto_queue), reset for reprocessing: thedead_letterblock is stripped andattemptsreset to 0, whilejob,trace_id,dataandmetaare preserved verbatim.to_queue— sandbox/redirect replay (the v1 safe-replay answer).dry_run— inspect and report the plan; every message 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. Pure codec + transport — no new dependency; the envelope stays frozen (GR-1). Exposed as
babelqueue.redrive.Tests / gate
8 tests via
InMemoryTransport(to-source, sandbox, dry-run, select, max, publish-failure-restores, no-dead_letter fallback, undecodable restored).redrive.pyat 99% line coverage;ruff+mypyclean; full suite 158 passed.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, reusing ADR-0025's out-of-band-header pattern.🤖 Generated with Claude Code