Runbook: Dead-letter queue handling
When messages reach dead-letter
Messages are moved to the dead-letter queue when they exceed the configured max_attempts in process_outbox_once(max_attempts).
Diagnostics
- List entries:
facade.list_dead_letter().awaitreturns all dead-letter messages withid,topic,payload,correlation_id, andattempts. - Use
correlation_idto correlate with checkout/transaction logs and trace the original request.
Replay
- Identify the message
idfromlist_dead_letter(). - Fix the root cause (e.g. downstream API availability, schema change, or configuration).
- Replay:
facade.replay_from_dead_letter(&message_id).await. Returnstrueif the message was found and re-enqueued. - The message is re-enqueued with
attemptsreset to 0 and will be processed again by the nextprocess_outbox_oncerun.
Do not
- Replay in a tight loop without fixing the cause; messages will fail again and return to dead-letter.
- Delete or clear dead-letter without logging or archiving if you need an audit trail.