7.4. 在原生模式中使用 onException 子句
在原生模式中使用 Camel onException 处理 时,您负责注册异常类来反映。
例如,具有带有 onException 处理的 camel 上下文:
onException(MyException.class).handled(true);
from("direct:route-that-could-produce-my-exception").throw(MyException.class);
onException(MyException.class).handled(true);
from("direct:route-that-could-produce-my-exception").throw(MyException.class);
应当注册 mypackage.MyException 类来反映。如需更多信息,请参阅 注册类以了解反映。