Hashlogics
Glossary

What is a dead-letter queue?

An order that never synced looks like a mystery. With a dead-letter queue, it's just an item waiting to be replayed.

Dead-letter queue

DLQ

A dead-letter queue is a separate queue that holds messages a system failed to process after a set number of retries. Rather than being discarded, the message is stored there so it can be inspected, fixed, and reprocessed later.

Most message queues assume the consumer on the other end will eventually process everything. In practice, some messages never will. The payload might be malformed, the downstream service might be down for good, or a bug in the handler might throw on every attempt. A queue with no dead-letter path either retries forever or drops the message and moves on.

A dead-letter queue gives that failure a third option. After a set number of failed attempts, often somewhere between three and ten, the message moves out of the main queue and into the DLQ.

Why it matters

Without one, failure looks like silence

A customer places an order. The system tries to sync it to the warehouse, and the warehouse API is down for ninety seconds. No dead-letter queue means one of two things happens. The message gets dropped, and the order never syncs. Nobody finds out until the customer calls asking where their package is.

Or the message retries forever, hammering a downstream service that is already struggling. The one message that needs a human look gets buried under thousands of identical retry attempts.

A dead-letter queue turns that mystery into a list. You can see exactly which orders failed, why they failed, and replay them once the warehouse API is back. The failure becomes an item on a queue, not a gap in the data nobody notices until someone complains.

  • 01The retry count that sends a message to the DLQ is a setting you choose, not a fixed number every queue shares.
  • 02A message in the DLQ still holds its original payload, so replaying it after a fix means no manual re-entry.
  • 03Most managed queues, including Amazon SQS and Azure Service Bus, support a DLQ natively; you configure it rather than build it.
Where a failed message goesLive
  1. SendMessage enters the main queue.
  2. ProcessConsumer picks it up.
  3. FailHandler throws or times out.
  4. RetryAttempted again, up to the set limit.
  5. Dead-letterLimit hit; moved out, not dropped.
  6. ReplayFixed and reprocessed on purpose.

The break happens at the retry limit. What differs is whether the message vanishes there or moves to a queue someone can see.

Questions, answered

Common questions

01What's the difference between a dead-letter queue and just retrying forever?

Retrying forever keeps hammering a failing dependency and hides the one message that needs a human look inside thousands of repeat attempts. A dead-letter queue stops retrying after a set limit and moves the message somewhere visible, so it gets fixed instead of endlessly repeated.

02Do I need to build a dead-letter queue myself?

Usually not. Amazon SQS, Azure Service Bus, and most managed queue and workflow platforms support a dead-letter queue as a configuration option. You set the retry limit and where failed messages land; you rarely build the mechanism from scratch.

03What happens to a message once it's in the DLQ?

It sits there until someone or something acts on it. A human might review the payload and fix the underlying issue. Or a scheduled job retries everything in the DLQ once a downstream service is confirmed back up. Without either, it just accumulates.

04How many retries should happen before a message is dead-lettered?

There's no universal number. A transient network blip might clear in two or three retries with backoff between them. A malformed payload fails every time no matter how many retries you allow. Set the limit around how long a real outage might last, not a guess.

Written by Abdul Basit, CEO, HashlogicsVerified
Start

Let’s build the one that runs after.

We build AI agents and automation, then stay on under an agreed service level. A senior engineer reads every brief, and your call gets scheduled within 24 hours.

What happens next

  1. 01

    You send a brief or book a call

    Two minutes, whichever you prefer.

  2. 02

    A senior engineer replies within 24 hours

    Not a sales rep.

  3. 03

    Honest scoping, in writing

    And if we’re not the right fit, we say so.

Abdul Basit, CEO of Hashlogics

“I started Hashlogics because too many teams ship a demo, get paid, and disappear. We build to a standard we’d run ourselves — and we stay to keep it running.”

Abdul Basit · CEO · a direct line

Not ready to talk? Take the checklist.

12 questions to ask any AI agency before you sign. They separate a demo shop from a team that ships to production.

Get the checklist

Free · no newsletter