Glossary

Dead Letter Queue (DLQ)

Where a message goes when the system has given up on it, for now. A dead letter queue keeps failed work visible and replayable instead of losing it or letting it block everything behind it.

General definition

Dead Letter Queue (DLQ) is a second queue attached to a main one. When a consumer fails to process a message, the broker retries it; after a set number of attempts, or when the message expires or is rejected outright, the broker moves it to the DLQ rather than returning it to the head of the line. The main queue keeps flowing, and the failed message waits where a person or an automated job can look at it. Amazon SQS calls the rule a redrive policy with a maximum receive count; RabbitMQ routes rejected or expired messages through a dead letter exchange; Kafka has no built-in DLQ, so teams write failed records to a dedicated dead-letter topic by convention.

A DLQ answers a specific failure, the poison message: one that fails every time because of its content (a malformed payload, a reference to a deleted record, a bug triggered by one edge case). Retrying it forever wastes capacity and, in an ordered queue, blocks every message behind it. Transient failures (a database timeout, a downstream service restarting) are better handled by retries with exponential backoff and jitter before the DLQ is involved. The number of attempts and the backoff schedule decide where that line sits.

Operating one well comes down to four habits:

  • Alert on depth and age. A DLQ nobody watches is a slower way of losing data. Alert when it is non-empty for longer than the normal fix time
  • Keep the reason. Attach the exception, the attempt count and the consumer version to the message so the failure can be diagnosed without reproducing it
  • Replay safely. Redriving to the main queue after a fix must be idempotent on the consumer side, since the message may already have had partial effects
  • Retain and purge. Give the DLQ its own retention so stale failures do not accumulate for months

In a messaging product the DLQ pattern shows up at the edges, not in the live chat path. A webhook to a customer endpoint that returns a 5xx error is retried with backoff, then parked for replay once the endpoint is healthy. A push notification token that FCM or APNs reports as unregistered is a terminal failure: the right move is to delete the token, not to retry, so a DLQ there should trigger cleanup rather than redelivery. Exporting audit logs, indexing search and running moderation jobs are the other places where a failed item needs a home. Exactly-once delivery explains why retries, and therefore DLQs, exist in the first place.

Building this into your own app? The Ethora chat SDK covers iOS, Android, React and React Native, with push notifications and file sharing included.

In the Ethora ecosystem

The live chat path in Ethora does not use a dead letter queue: XMPP on ejabberd delivers to connected clients directly, and a client that was offline catches up from the server-side message archive on reconnect, so a message is never “dead” from the user’s point of view. The queue pattern belongs to the asynchronous work around it: push delivery through FCM and APNs, the compliance audit trail with immutable log export, Trust & Safety reports sent to your systems through a message bus, API or email, and AI agent replies triggered by room events.

On the managed cloud those pipelines and their retry behaviour are Ethora’s responsibility. On a dedicated or self-hosted deployment you own the broker and its queues, so dead-letter handling for integrations that call your own endpoints follows your infrastructure’s conventions, and the included Grafana and Prometheus monitoring is the place to alert on queue depth.

Get started

Add real-time chat to your app

An open-source chat SDK for iOS, Android, React and React Native, on our cloud or self-hosted.

Explore the Chat SDK
Free tier available Enterprise SLA No vendor lock-in