Class Redrive
The operator-side counterpart to the runtime's dead-letter routing: it reads dead-lettered
messages off a DLQ and re-publishes each to its source queue (its dead_letter
.original_queue) or to a chosen queue, reset for reprocessing
— the dead_letter block removed and attempts reset to 0, while job,
trace_id, data and meta are preserved verbatim.
The Java core is codec-only (transports are separate artifacts), so redrive(com.babelqueue.Redrive.Transport, java.lang.String, com.babelqueue.Redrive.Options) works
over a minimal Redrive.Transport the caller implements over their broker — the same shape as
the otel module's Sender. The wire envelope stays frozen (GR-1) and no
dependency is added.
Safety is dryRun + sandbox routing (toQueue) + select. The
bypass option stamps a bq-replay-bypass transport header (see Replay)
so a handler can skip external side-effects on a replay; it takes effect on transports that
implement Redrive.HeaderPublisher (ADR-0027).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn optionalRedrive.Transportcapability: publish a body together with out-of-band transport headers (e.g.static final recordWhat happened to one message during aredrive(com.babelqueue.Redrive.Transport, java.lang.String, com.babelqueue.Redrive.Options)run.static final recordOptions for aredrive(com.babelqueue.Redrive.Transport, java.lang.String, com.babelqueue.Redrive.Options)run; immutable, built with the fluent withers fromRedrive.Options.all().static final recordA reserved DLQ message: its raw body, a transport-specific handle used to ack it, and any out-of-band transport headers (e.g.static final recordstatic interfaceThe minimal transport surfaceredrive(com.babelqueue.Redrive.Transport, java.lang.String, com.babelqueue.Redrive.Options)needs, implemented over any broker. -
Method Summary
Modifier and TypeMethodDescriptionstatic Redrive.Resultredrive(Redrive.Transport transport, String dlq, Redrive.Options opts) Drains dead-lettered messages offdlqand re-publishes each (reset) to its source queue oropts.toQueue.static EnvelopeReturns a copy ofenvreset for reprocessing: thedead_letterblock is removed andattemptsreset to 0;job,trace_id,dataandmetaare preserved verbatim.
-
Method Details
-
reset
Returns a copy ofenvreset for reprocessing: thedead_letterblock is removed andattemptsreset to 0;job,trace_id,dataandmetaare preserved verbatim. -
redrive
public static Redrive.Result redrive(Redrive.Transport transport, String dlq, Redrive.Options opts) throws Exception Drains dead-lettered messages offdlqand re-publishes each (reset) to its source queue oropts.toQueue. Messages are drained first and then processed, so restored messages (skipped, dry-run, or undecodable) are not re-encountered; a DLQ message is acknowledged only after a successful re-publish, and an undecodable body is restored rather than dropped.- Returns:
- a
Redrive.Resultwith redriven/skipped counts and a per-message breakdown - Throws:
Exception- if the transport fails; on a publish failure the message is restored to the DLQ before the error is re-thrown
-