Cloud concept · Updated

Dead-Letter Queues - Dead-letter queues are separate queues that hold messages or events a system could not deliver or process under its configured failure policy.

In short

A dead-letter queue (DLQ) isolates failed messages from the normal processing path and retains them for investigation, correction, or replay. It lets healthy traffic continue without repeatedly retrying the same bad input, but it only prevents silent loss if the failure route is monitored and someone owns recovery.

Cloud Concepts Hub →

5 key aspects of Dead-Letter Queues

A dead-letter queue combines bounded retries, failure isolation, diagnostic context, and a monitored path to replay or disposal.

01
Bounded retries

Set a retry or age limit that allows recovery from transient failures without retrying persistent failures indefinitely. Verify whether the limit counts receives, processing failures, or elapsed time.

02
Explicit ownership of failures

Identify which layer owns each failure mode: delivery to the consumer, execution by the consumer, or transfer to the DLQ. Configure and test the corresponding failure route rather than assuming one DLQ covers the entire pipeline.

03
Diagnostic context

Retain the original payload and a stable correlation ID, along with the source and failure reason where available. Use logs to recover details the DLQ does not preserve.

04
Monitoring and retention

Track new arrivals, backlog age, and failed dead-letter transfers. Set retention and access controls for the time needed to investigate and the sensitivity of the payload.

05
Controlled replay

Fix the underlying problem before redriving messages, then replay in small batches at a rate downstream systems can handle. Use idempotent processing and check ordering requirements before returning older events to live traffic.

Cloud services for Dead-Letter Queues

By attaching an SQS queue to an EventBridge rule target and a separate failure queue to Lambda asynchronous invocations, operators can distinguish events that never reached the function from events the function accepted but could not process. If Lambda instead consumes an SQS work queue through an event source mapping, the work queue's redrive policy governs dead-lettering. Azure Service Bus provides a dead-letter subqueue for each queue or topic subscription, while Pub/Sub forwards failed deliveries to a dead-letter topic. In each design, monitor the recovery path separately from the normal processing path.

AWS LambdaAWS Lambda

For asynchronous invocations, Lambda can send discarded events to an Amazon SQS queue or Amazon SNS topic configured as a DLQ after retry or event-age limits are reached. An on-failure destination can instead deliver a richer invocation record; for an SQS event source mapping, configure dead-lettering on the source queue rather than on the function's asynchronous invocation settings.

Service Bus

Azure Service Bus queues and topic subscriptions have built-in dead-letter subqueues. Messages can be dead-lettered automatically when the maximum delivery count is exceeded or explicitly by an application that identifies an unprocessable message.

Amazon EventBridgeAmazon EventBridge

EventBridge rules can send events that could not be delivered to a target to a standard SQS DLQ. That queue captures target-delivery failures, not processing failures after the target has accepted the event.

What is Dead-Letter Queues

2 min read

A dead-letter queue is the quarantine path for asynchronous work. In the normal path, a broker or event runtime delivers a message, and a consumer acknowledges it after processing succeeds. A message that reaches a delivery-attempt limit, exceeds an event-age limit, or is explicitly classified as unprocessable can be sent to a DLQ instead of being retried indefinitely. The available triggers depend on the system: some brokers count receives rather than application errors, and some discard expired messages unless dead-lettering on expiration is enabled.

Configure the policy at the layer that owns delivery and retries. A message broker can observe acknowledgments, rejects, and delivery attempts; an asynchronous function runtime can observe whether an invocation succeeds. A broker's delivery DLQ does not necessarily capture an application error that occurs after the receiver has acknowledged the message. Likewise, a DLQ for asynchronous invocations does not capture synchronous errors returned to callers. When a function polls a queue through an integration, the source queue may own redelivery and dead-lettering rather than the function's asynchronous invocation settings.

For example, an order worker might retry a transient inventory API timeout with backoff, but dead-letter an order whose schema version it cannot read. If explicit dead-lettering is unavailable, the invalid order can reach the configured retry limit instead. Give transient failures enough time to clear, but bound retries so a persistent failure does not consume worker capacity or block a delivery group. With batch processing, acknowledge successful records separately if the integration supports it; otherwise, one bad record can cause the entire batch to be delivered again.

A DLQ is not a retry scheduler, a backup, or a rollback mechanism. An event may have caused side effects before it failed, and replay may deliver it again or place it after newer events. Preserve the original event ID and enough source and failure information to correlate the record with logs, since not every DLQ includes detailed error metadata. Make consumers idempotent and decide whether allowing later events to proceed is acceptable for workflows that require strict ordering.

Operate the DLQ as a queue with an owner and a runbook. Alert on new arrivals and aging backlog, and monitor failed transfers to the DLQ itself, such as those caused by permissions or payload limits. Set retention to cover the investigation window, verify when the retention clock starts, and restrict access because failed payloads can contain sensitive data. After fixing the cause, replay a small sample before redriving the backlog at a controlled rate. Correct or dispose of records that cannot be processed safely according to policy, rather than automatically feeding them back into the same failure loop.

Dead-Letter Queues exam questions

Real practice exam questions on Dead-Letter Queues, with the correct answer and its explanation. Answer them with every option in the exam simulator.

DVA-C03

A utility uses an AWS Lambda function with an Amazon SQS event source mapping to import meter readings. During traffic spikes, some invocations are throttled before the handler runs. During brief database outages, the handler runs but returns an error. The operations team wants to give the database more time to recover before failed messages become available to receive again and to move messages that reach a configured receive limit to a quarantine queue. The developer cannot change the function code or its concurrency settings. Which solution meets these requirements and correctly describes what happens during throttling?

Show answerCORRECT ANSWER

Increase the source queue's visibility timeout and configure its redrive policy to send messages to the quarantine queue. During throttling, Lambda reduces concurrency for the mapping and stops retrying the current delivery when its visibility window expires.

The visibility timeout controls when a received message that has not been deleted becomes available to receive again. The source queue's redrive policy uses maxReceiveCount to route repeatedly received messages to the dead-letter queue. During throttling, Lambda backs off by reducing concurrency and stops retrying that delivery when the visibility window expires. This does not mean Lambda deletes the message from SQS.

Practice Dead-Letter Queues in a full exam

Questions on Dead-Letter Queues in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

Learn Dead-Letter Queues in lessons

2 short lessons on Dead-Letter Queues in 1 certification course.

Open the lessons