Redrive Docs
Docs: Redriving

Redriving

Group failed messages by fault and move them back to the queue they came from.

Redriving moves messages from an error queue back to the queue they failed in. Redrive groups an error queue’s messages by fault, so you can redrive or discard one type of fault at a time.

Scan for faults

A scan reads messages from the head of an error queue, groups them by fault and returns them.

A scan keeps the messages it reads until it ends, so consumers can’t take them in the meantime, and then returns them in their original order. Two limits bound a scan:

Limit Default Environment variable
Fault scan depth 100,000 REDRIVE_SCAN_MAX_DEPTH
Fault scan time limit 20 min REDRIVE_SCAN_TIME_LIMIT_MINUTES

A scan that reaches the time limit stops and keeps what it found, and so does a cancelled scan. Keep the time limit below your broker’s consumer timeout, or RabbitMQ closes the channel first.

While a scan runs, Peek, redrive and discard are disabled, because the scan has the messages. A restart clears scan results.

Note: Before RabbitMQ 4.3, scanning a quorum queue uses up delivery attempts and Redrive asks first, as with a peek. See Peek messages for more information.

Fault groups

An error queue after a scan: one fault group, its messages and the fault of the open one

Redrive groups messages by exception type, consumer and exception message. It ignores the parts of a message that change from one failure to the next, such as ids and numbers, so “Order 812 not found” and “Order 913 not found” land in the same group.

A group shows up to 20 sample messages. When you’ve worked through them, scan again to see the rest.

Turn off Group by exception to work with peeked messages one by one. Dead-letter queues open that way. A _skipped queue has no scan and no groups.

Known failures

Known failures tells you whether a fault group is new, how long it has been around and how often it came back after you cleared it.

Redrive records each type of fault a scan finds. It records on every plan, so the history is there when you move to Team.

In the group table Meaning
New Redrive hadn’t seen this type of fault before this scan
Since Oct 12 When the failure first appeared
back 3 times How many times it came back after it was cleared

A type of fault is cleared when you purge its queue, or when a group redrive, a group discard or Redrive all faults reads the queue to its end without stopping or failing. Redriving or discarding picked messages never clears it. Redrive can’t see a clear made outside it, such as a purge in the management UI.

The Failure kinds view, under the Errors chip on Queues, lists every type of fault Redrive has recorded across the brokers in scope. A row opens the queue with that group selected, when the queue’s latest scan has it.

Redrive forgets a type of fault it hasn’t seen for 90 days. Deleting a broker deletes what was recorded for it.

What a redrive does

Redrive publishes a copy of each message straight to the target queue, and removes the original once the broker confirms the copy. A failed publish leaves the original where it was.

Queue Default target
_error The name without _error: submit-order_error redrives to submit-order
Dead-letter The queue the message was dead-lettered from
_skipped The name without _skipped: submit-order_skipped moves to submit-order

The confirmation for redriving a fault group

You can change the target before you confirm. Redrive refuses a target that doesn’t exist.

The copy keeps the original body and AMQP properties. Redrive adds three headers to it:

Header Value
x-redrive-count How many times the message has been redriven
x-redrive-source The queue it was redriven from
x-redrive-at When, in UTC

Remove the fault headers, on by default, strips MT-Fault-* and MT-Reason from the copy. MT-Host-* stays.

Redrive and discard

Action Covers
Redrive on a message That message
Move N to… The messages you picked
Redrive group Every message in the queue with the selected fault
Move group to… The same, to a queue you pick
Redrive all faults Every message in the queue
Discard N, Discard group The picked messages or the group, removed

A group run takes every message with that fault, including any the scan didn’t reach.

Discard removes each matching message from the queue. The message isn’t dead-lettered, and its Activity entry is the only trace.

Discarding Redrive asks you to
Up to 10 messages Confirm once
More than 10 messages Type the count
A group Type the group’s name, such as fault group 1

Hold Shift to skip the confirmation. To empty a whole queue, use Purge.

Copy as issue

Copy as issue copies the selected fault group to the clipboard as Markdown for your issue tracker, with a link back to the group. The button is the copy icon beside the group’s name.

The link starts with the address you opened Redrive at, so it works only for people who can reach that address.

Edit before redriving

Edit lets you change one message’s body and headers before it’s redriven. You can add, change or remove string, number and boolean headers. Tables, arrays and binary headers pass through as they are.

A JSON body must stay valid JSON, and a MassTransit envelope must still parse as one. An XML body must stay well formed. A binary body can’t be edited, but its headers can.

The Activity entry is tagged Edited.

How selections are matched

The queue keeps moving between a peek and a redrive, so Redrive finds the messages you picked by their message id, wherever they now are in the queue.

Limit Default Environment variable What it bounds
Redrive batch limit 1,000 REDRIVE_REDRIVE_BATCH_LIMIT How many picked messages one redrive or discard can name
Redrive scan depth 1,000 REDRIVE_REDRIVE_SCAN_DEPTH How deep a run reads looking for the picked messages

Redrive reports a picked message deeper in the queue than the redrive scan depth as no longer in the queue. Group runs and Redrive all faults use neither limit. They read up to REDRIVE_SCAN_MAX_DEPTH.

Stop and failures

Group runs and Redrive all faults have a Stop button. Redrive checks for Stop between messages, so the message in hand is either moved or left where it was.

A run stops at the first message it can’t move. That message stays on the queue with the broker’s error. Messages moved before it stay moved, and messages read but not matched go back. Redrive doesn’t roll a run back.

Activity records the run as Stopped, with the real count and the reason.