Dead letter queue
{{Short description|Term used in message queueing}}
In message queueing a dead letter queue (DLQ), or dead letter topic (DLT) in some messaging systems, is a service implementation to store messages that the messaging system cannot or should not deliver.{{cite web|url=https://www.enterpriseintegrationpatterns.com/patterns/messaging/DeadLetterChannel.html|title=Dead Letter Channel|website=www.enterpriseintegrationpatterns.com}} Although implementation-specific, messages can be routed to the DLQ for the following reasons:
- The message is sent to a queue that does not exist.{{cite book|last=Redkar|first=Arohi|title=Pro MSMQ: Microsoft Message Queue Programming|publisher=Apress|year=2004|isbn=1430207329|pages=148}}{{cite web|url=http://pic.dhe.ibm.com/infocenter/wmqv7/v7r1/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fic10420_.htm|title=Dead-letter queues|publisher=IBM|accessdate=23 February 2014}}
- The maximum queue length is exceeded.
- The message exceeds the size limit.
- The message expires because it reached the TTL (time to live){{Cite web|title=Dead Letter Exchanges — RabbitMQ|url=https://www.rabbitmq.com/dlx.html|access-date=2020-12-06|website=www.rabbitmq.com}}
- The message is rejected by another queue exchange.RabbitMQ dead letter queue {{cite web|url=https://www.rabbitmq.com/dlx.html|title=Dead Letter Exchanges|access-date=2016-05-06|archive-date=2016-05-05|archive-url=https://web.archive.org/web/20160505104043/http://www.rabbitmq.com/dlx.html|url-status=live}}
- The message has been read and rejected too many times.{{Cite web|title=Amazon SQS dead-letter queues|url=https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html|publisher=AWS|access-date=2023-04-14|archive-date=2023-04-14|archive-url=https://web.archive.org/web/20230414162538/https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html|url-status=live}}
Routing these messages to a dead letter queue enables analysis of common fault patterns and potential software problems. If a message consumer receives a message that it considers invalid, it can instead forward it an Invalid Message Channel,{{Cite web|title=Invalid Message Channel|url=https://www.enterpriseintegrationpatterns.com/patterns/messaging/InvalidMessageChannel.html|website=www.enterpriseintegrationpatterns.com|access-date=2023-04-14|archive-date=2023-04-14|archive-url=https://web.archive.org/web/20230414162539/https://www.enterpriseintegrationpatterns.com/patterns/messaging/InvalidMessageChannel.html|url-status=live}} allowing a separation between application-level faults and delivery failures.
Management of dead letter queues typically involves monitoring and alert systems. Organizations may implement specialized handlers for automated remediation or manual processing of DLQ messages.
Queueing systems that incorporate dead letter queues include Amazon EventBridge,{{cite web |url= https://aws.amazon.com/it/about-aws/whats-new/2020/10/amazon-eventbridge-announces-support-dead-letter-queues |title= Amazon EventBridge announces support for Dead Letter Queues |publisher= Amazon |access-date= 2020-10-30 |archive-date= 2024-12-17 |archive-url= https://web.archive.org/web/20241217225540/https://aws.amazon.com/it/about-aws/whats-new/2020/10/amazon-eventbridge-announces-support-dead-letter-queues/ |url-status= live }} Amazon Simple Queue Service,{{cite web|url=http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html|title=Using Amazon SQS Dead Letter Queues|publisher=Amazon|accessdate=23 February 2014}} Apache ActiveMQ, Google Cloud Pub/Sub,{{Cite web|title=Forwarding to dead-letter topics {{!}} Cloud Pub/Sub|url=https://cloud.google.com/pubsub/docs/dead-letter-topics|access-date=2020-12-26|website=Google Cloud|language=en}} HornetQ, Microsoft Message Queuing, Microsoft Azure Event Grid and Azure Service Bus,{{Cite web|url=https://docs.microsoft.com/en-us/azure/event-grid/compare-messaging-services?toc=%2fazure%2fservice-bus-messaging%2ftoc.json|title=Compare Azure messaging services|last=spelluru|date=|website=docs.microsoft.com|language=en-us|archive-url=|archive-date=|access-date=2020-01-17}} WebSphere MQ,{{cite book|last=Böhm-Mäder|first=Johannes|title=WebSphere MQ Security: Tales of Scowling Wolves Among Unglamorous Sheep|date=14 December 2011 |publisher=BoD|pages=68|isbn=978-3842381506}} Solace PubSub+,{{cite web|url=https://docs.solace.com/Configuring-and-Managing/Setting-Dead-Msg-Queues.htm|title=Solace Dead Message Queues}} Rabbit MQ, Confluent Cloud{{cite web|url=https://docs.confluent.io/cloud/current/connectors/dead-letter-queue.html|title=Confluent Cloud documentation|access-date=2021-02-12|archive-date=2021-03-04|archive-url=https://web.archive.org/web/20210304102205/https://docs.confluent.io/cloud/current/connectors/dead-letter-queue.html|url-status=live}} and Apache Pulsar.{{cite web|url=https://pulsar.apache.org/docs/en/concepts-messaging/#dead-letter-topic|title=Apache Pulsar documentation}}{{cite web|url=https://github.com/apache/pulsar/wiki/PIP-22:-Pulsar-Dead-Letter-Topic|title=Apache Pulsar PIP-22:Dead Letter Topic|website=GitHub }}