feat(redrive): DLQ redrive tooling — safe replay (ADR-0026)#3
Merged
Conversation
BabelQueue\Redrive: the PHP mirror of the Go redrive reference, adapted to PHP's publish-only Transport. Redrive::reset() (pure: strip dead_letter, attempts->0, preserve job/trace_id/data/meta) + Redrive::run(RedriveIO, dlq, opts) over a small reserve/ack/publish seam — re-publishes each dead-lettered message to its dead_letter.original_queue or a sandbox toQueue. Options: toQueue, max, dryRun, select. Drains-then-processes; acks only after a successful re-publish; restores undecodable bodies and on publish failure. No new dependency; envelope frozen (GR-1). Replay-Bypass header documented as 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 PHP mirror of the Go
babelqueue-goRedrive(ADR-0026) — the operator tool the error-handling contract deferred ("re-driving … is an operator/tooling concern"). Adapted to PHP's publish-onlyTransport.What
BabelQueue\Redrive\Redrive::reset(array $envelope): array— pure: strip thedead_letterblock, resetattemptsto 0, preservejob/trace_id/data/metaverbatim.Redrive::run(RedriveIO $io, string $dlq, ?RedriveOptions $options): RedriveResult— drains the DLQ and re-publishes each (reset) message to itsdead_letter.original_queueor$options->toQueue. Because the coreTransportis publish-only, redrive drives a smallRedriveIO(reserve / ack / publish) the caller binds to their broker.toQueue(sandbox replay),max,dryRun(report the plan, restore everything unchanged),select(a predicate). Drains-then-processes; acks a DLQ message only after a successful re-publish; restores undecodable bodies and on a publish failure rather than dropping them.Tests / gate
tests/Redrive/RedriveTest.php— 8 tests via an in-memoryRedriveIO(to-source reset+trace preserved, sandbox, dry-run, select, max, restore-on-publish-failure, undecodable restored,resetpurity).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