Skip to Content
Technical Articles
Author's profile photo Bhalchandra Wadekar

EIPinCPI – Dead Letter Channel

Previous – Invalid Message Channel | Index | Next – Guaranteed Delivery

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

Fetch%20Orders

Fetch Orders

This flow starts immediately using Timer Start Event, sets the body using Content Modifier, and pushes the message in JMS Queue ‘Orders’ using JMS Receiver Adapter.

Configuration of JMS Receiver Adapter

Property Value
Queue Name Orders
Encrypt Stored Message Unchecked

Integration Flow – Send Orders

Send%20Orders

Send Orders

This flow fetches the Orders from ‘Orders’ queue using JMS Sender Adapter and sends an email with contents using Mail Receiver Adapter.

Configuration of JMS Sender Adapter

Property Value
Queue Name Orders
Dead-Letter Queue Checked

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

Tab Property Value
Connection Address smtp.gmail.com:587
Connection Authentication Plain User/Password
Connection Credential Name Google
Processing From eipincpi@gmail.com
Processing To eipincpi@gmail.com

Output

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.

For more detailed information on Dead Letter Channel, check out Mandy‘s blog on configuring Dead Letter Handling in JMS Adapter.

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.

Conclusion

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.

References/Further Readings

Hope this helps,
Bala

Previous – Invalid Message Channel | Index | Next – Guaranteed Delivery

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.