178.6.7. 使用 JMS 作为 Dead Letter Channel 只存储错误

您可以使用 JMS 存储导致的错误消息或存储自定义正文,您可以自行初始化。以下示例使用 Message Translator EIP 在移到 JMS dead letter 队列前对失败的交换进行转换:

// we sent it to a seda dead queue first
errorHandler(deadLetterChannel("seda:dead"));

// and on the seda dead queue we can do the custom transformation before its sent to the JMS queue
from("seda:dead").transform(exceptionMessage()).to("jms:queue:dead");

在这里,我们只将原始原因错误消息存储在转换中。但是,您可以使用任何表达式来发送您需要的任何表达式。例如,您可以在 Bean 上调用方法或使用自定义处理器。