处理 CAMEL 邮件异常

Handling CAMEL Mail exception

我正在尝试在没有连接的情况下在 CAMEL 中捕获异常,如下所示:

<from uri="imap://Uri"/>
   <onException>
    <exception>javax.mail.MessagingException</exception>
            <exception>java.net.NoRouteToHostException</exception>
   <handled>
        <constant>true</constant>
    </handled>
    <transform>
        <simple>Error reported: ${exception.message} - cannot process this message.</simple>
    </transform>
</onException>

但它不起作用。我收到此错误消息:

javax.mail.MessagingException: No route to host: connect;
  nested exception is:
    java.net.NoRouteToHostException: No route to host: connect

怎么了?

如果错误来自消费者,例如 <from> 那么您需要桥接来自消费者的错误处理程序。

查看此常见问题解答:

邮件组件也可以使用网桥选项。