A dead-letter queue (DLQ) is a holding area for messages that a system cannot process or deliver.
Messages fail for predictable reasons: wrong format, unreachable endpoint, expired TTL. Instead of discarding them or retrying forever, the system moves them to the DLQ. The failed message sits there until someone investigates.
The term originates from postal services. A "dead letter" was mail that couldn't be delivered or returned to the sender. Message brokers and cloud platforms adopted the concept: RabbitMQ, AWS SQS, Google Cloud Pub/Sub, and Azure Service Bus all support dead-letter queues natively.
Why dead-letter queues matter for scheduled tasks#
Scheduled jobs often trigger downstream work through queues or webhooks. A nightly report job might push results to an SQS queue for processing. A Cloud Cron task might call an API endpoint that feeds into a message pipeline. When something in that pipeline breaks, messages pile up or vanish. A DLQ catches what would otherwise be lost.
Without a DLQ, failed messages either retry indefinitely (wasting compute and potentially causing duplicate side effects) or get dropped silently. Both are bad for cron jobs that run unattended. You won't know the job's output never arrived until something downstream breaks hours or days later.
How a dead-letter queue works#
The basic flow: a producer sends a message to a queue. A consumer picks it up and tries to process it. If processing fails, the message goes back to the queue for a retry. After a configured number of retries (the "max receive count" in AWS terms), the system stops retrying and routes the message to the DLQ. The original queue moves on. Failures land in the DLQ for manual review or automated reprocessing.
How to monitor a dead-letter queue#
A DLQ without alerting is just a graveyard. Messages accumulate, nobody checks, failures go unnoticed. That matters. DLQ depth is one of the first metrics teams wire up to their alerting systems — if the count grows beyond a threshold, something upstream is broken.
For teams running scheduled tasks, combining a DLQ with cron job monitoring covers both sides of the problem. The monitor catches jobs that don't run. The DLQ catches jobs that run but produce output that can't be delivered. Together, they close the gap between "the job executed" and "the results actually arrived."