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 .NET mirror of babelqueue-go Redrive (ADR-0026) — the operator tool for replaying off the dead-letter queue.

What

Redrive.RedriveAsync(transport, dlq, options) drains a DLQ and re-publishes each message to its dead_letter.original_queue (or options.ToQueue), reset for reprocessing: the dead_letter block stripped and attempts reset to 0 (via a record with-expression), while Job, TraceId, Data and Meta are preserved verbatim. Options are ToQueue (sandbox), Max, DryRun, Select.

The codec-only .NET core has no transport, so RedriveAsync works over a minimal Redrive.ITransport seam (async PopAsync/PublishAsync/AckAsync) the caller implements over their broker. Drains-then-processes; acks a DLQ message only after a successful re-publish; restores undecodable bodies (a null-Job envelope) and, on a publish failure, restores via try/finally before the error propagates. No new dependency; envelope frozen (GR-1).

Tests / gate

8 xUnit tests via an in-memory ITransport (to-source + reset/trace preserved, sandbox, dry-run, select, max, publish-failure-restores, undecodable restored, no-dead_letter fallback). dotnet test -c Release: 49 passed, 0 failed, analyzers + TreatWarningsAsErrors clean.

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.

🤖 Generated with Claude Code

.NET mirror of babelqueue-go Redrive: Redrive.RedriveAsync(transport, dlq, options) drains a DLQ and re-publishes each message (Reset: strip dead_letter, attempts->0, preserve job/trace_id/data/meta via a record with-expression) to its dead_letter.original_queue or options.ToQueue. Options ToQueue/Max/DryRun/Select. The codec-only core has no transport, so it works over a minimal Redrive.ITransport seam (async pop/publish/ack). Drains-then-processes; acks only after a successful re-publish; restores undecodable bodies (a null-Job envelope) and on publish failure (try/finally). No new dependency; envelope frozen. Replay-Bypass header documented as phase two.
@muhammetsafak muhammetsafak merged commit e31e635 into main Jun 19, 2026
6 checks passed
@muhammetsafak muhammetsafak deleted the feat/redrive branch June 19, 2026 05:46
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