Skip to content

feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3

Merged
muhammetsafak merged 1 commit into
mainfrom
feat/redrive
Jun 19, 2026
Merged

feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3
muhammetsafak merged 1 commit into
mainfrom
feat/redrive

Conversation

@muhammetsafak

Copy link
Copy Markdown
Member

The Python mirror of babelqueue-go Redrive (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 its dead_letter.original_queue (or to_queue), reset for reprocessing: the dead_letter block is stripped and attempts reset to 0, while job, trace_id, data and meta are 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.py at 99% line coverage; ruff + mypy clean; full suite 158 passed.

Follow-up

The Replay-Bypass guard (a bq-replay-bypass transport 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

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.
@muhammetsafak muhammetsafak merged commit e8353f2 into main Jun 19, 2026
11 checks passed
@muhammetsafak muhammetsafak deleted the feat/redrive branch June 19, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant