EIPinCPI – Dead Letter Channel
This week, we’ll study a pattern known as Dead Letter Channel.
When do I use this pattern?
Dead Letter Channel is used for messages that were not delivered to the receivers. For example, if a message cannot be delivered because a receiver is down or the quota of calls is reached, then the message is moved to Dead Letter Channel. Note that, in CPI, implementation of Dead Letter Channel can only be used to tackle Node failure or Out of Memory issues.
Dead Letter Channel in CPI
In CPI, Dead Letter Channel can be used by changing the configuration on the JMS Sender Adapter.
Integration Flow – Fetch Orders
Configuration of JMS Receiver Adapter
|Encrypt Stored Message||Unchecked|
Integration Flow – Send Orders
Configuration of JMS Sender Adapter
Please note that Dead-Letter Queue is checked and this will create a Queue that holds messages that have been failed to be delivered.
Configuration of Mail Receiver Adapter
We’ll run the first flow once to have the message in the queue. Then, we’ll run the second flow to consume the message.
If the number of orders placed is large enough, then there might be a node failure or out of memory error. In that case, the message is moved to the Dead Letter Queue. This message can be found in the Queue Monitor with status Blocked.
The messages can be moved back to the queue from Dead Letter Queue once the issue has been resolved by simply retrying them.
EIPinCPI Rating – 8/10
With the support of JMS, CPI supports Dead Letter Channel. However, Dead Letter Channel only deals with issues inside CPI and the developer will need to create their own Dead Letter Queue similar to Invalid Message Channel to handle the delivery issues. Therefore, in my opinion, this pattern gets 8 out of 10 EIPinCPI rating.
Dead Letter Channel is useful for storing messages that have failed delivery. Later, the messages could be moved to the original queue for retry. In CPI, only CPI’s internal issues like node failure or out of memory error are handled in Dead Letter Channel.
- Dead Letter Channel Pattern in Enterprise Integration Patterns
- Mandy‘s blog on configuring Dead Letter Handling in JMS Adapter
- CPI Components
Hope this helps,