28.5.7. 将 JMS 用作死信频道存储错误
您可以使用 JMS 存储原因错误消息或存储自定义正文,您可以自行初始化。以下示例使用 Message Translator EIP 在移至 JMS 死信队列之前对失败交换进行转换:
// 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 上调用方法或使用自定义处理器。