Enterprise Integration Patterns
Messaging Patterns
HOME PATTERNS RAMBLINGS ARTICLES TALKS DOWNLOAD BOOKS CONTACT
Messaging Patterns
Dead Letter ChannelDead Letter ChannelMessaging Patterns » Messaging Channels

An enterprise is using Messaging to integrate applications.

What will the messaging system do with a message it cannot deliver?

When a messaging system determines that it cannot or should not deliver a message, it may elect to move the message to a Dead Letter Channel.

The specific way a Dead Letter Channel works depends on the specific messaging system’s implementation, if it provides one at all. The channel may be called a “dead message queue” [Monson-Haefel, p.125] or dead letter queue (DLQ). [MQSeries], [Dickman, pp.28-29] Typically, each machine the messaging system is installed on has its own local Dead Letter Channel so that whatever machine a message dies on, it can be moved from one local queue to another without any networking uncertainties. This also records what machine the message died on. When the messaging system moves the message, it may also record the original channel the message was supposed to be delivered on.

... Read the entire pattern in the book Enterprise Integration Patterns

Example: Dead Letter Queue in Amazon SQSNEW

Many hosted messaging systems, including Amazon's Simple Queuing Service (SQS) include a Dead Letter Channel. Amazon's Dead Letter Queue behavior is closely related to the way SQS delivers messages. After a consumer fetches a message from a queue, the messages remains on the queue, but hidden from other consumers to avoid fetching and processing the same message multiple times. After processing a message, the consumer is responsible for explicitly deleting the message. If the consumer doesn't delete the message, for example because because it crashed while processing the message, the message becomes visible again after the message's Visibility Timeout expires. Each time this happens, the message's receive count is increased. When this count reaches a configured limit, the message is considered undeliverable and placed in a designated Dead Letter Queue. Other AWS services like Amazon EventBridge also feature a Dead Letter Channel.

Example: Kafka ConnectNEW

Kafka Connect, Confluent's tool for data streaming to and from Kafka includes a Dead Letter Channel for sink connectors. As per the documentation, the Dead Letter Channel is active when the connector is configured to tolerate errors (otherwise, it'd abort and not send messages to any queue). The name of the Dead Letter Channel can easily be configured:

errors.tolerance = all
errors.deadletterqueue.topic.name = <dead-letter-topic-name>

Related patterns:

Invalid Message Channel, Message Expiration, Selective Consumer, Messaging


Creative Commons Attribution License

You can reuse the following elements under the Creative Commons Attribution license: pattern icon, pattern name, problem and solution statements (in bold), and the sketch. Other portions are protected by copyright.

Enterprise Integration Patterns book cover

Enterprise Integration Patterns
The de-facto language for designing asynchronous, distributed systems. Over 100,000 copies sold.

Software Architect Elevator book cover

The Software Architect Elevator
Rethink the role of architects as a connecting element across organizational layers. Acquire the technical, communication, and organizational skills to succeed in this new role.

Cloud Strategy book cover

Cloud Strategy
Make your cloud migration a success by translating high-level goals into conscious decisions with well-understood trade-offs.

Platform Strategy book cover

Platform Strategy
Platforms can boost innovation through harmonization, but they aren't easy to build. Learn from over a decade of designing and rolling out IT platforms.