Class Redrive

java.lang.Object
com.babelqueue.Redrive

public final class Redrive extends Object
DLQ redrive tooling — safe replay off the dead-letter queue (ADR-0026).

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).

  • Method Details

    • reset

      public static Envelope reset(Envelope env)
      Returns a copy of env reset for reprocessing: the dead_letter block is removed and attempts reset to 0; job, trace_id, data and meta are preserved verbatim.
    • redrive

      public static Redrive.Result redrive(Redrive.Transport transport, String dlq, Redrive.Options opts) throws Exception
      Drains dead-lettered messages off dlq and re-publishes each (reset) to its source queue or opts.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.Result with 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