Service Bus Dead-Lettering
Problem
- One message on your Azure Service Bus queue has bad data and throws every time your Azure Function tries to process it.
- Your function abandons the message, and Service Bus redelivers it immediately.
- That same bad message gets retried forever, and every order queued behind it waits.
One message stuck at the front blocks the entire line behind it.
Solution
Service Bus Dead-Lettering
- Service Bus counts how many times a message has failed delivery.
- After a set number of failures, Service Bus automatically moves that message to a separate dead-letter queue.
- The main queue is now clear, and the bad message waits on its own, ready to be inspected and fixed separately.
A message that can't be processed shouldn't block the ones that can. That's the whole idea behind dead-lettering.
Analogy
A supermarket cashier scans an item and it has no barcode.
Instead of holding the whole line while it gets sorted out, the cashier sets it aside in the price-check bin and waves the next customer through.
Dead-lettering is that price-check bin: the one broken item steps aside, and the line keeps moving.