无法在 Camel 3.8.0 中配置 doCatch 块 XML
Cannot configure doCatch block in Camel 3.8.0 XML
从 Camel 3.8.0 开始,我无法在 XML 中配置 doCatch 块,如下所示:
<routes xmlns="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring.xsd">
<route>
<from uri="direct:start" />
<doTry>
<to uri="log:try" />
<doCatch>
<exception>java.lang.RuntimeException</exception>
<to uri="log:catch" />
</doCatch>
</doTry>
</route>
</routes>
我得到
Caused by: java.lang.IllegalArgumentException: This doCatch should have a doTry as its parent on DoCatch[ [class java.lang.RuntimeException] -> [To[log:catch]]]
at org.apache.camel.reifier.CatchReifier.createProcessor(CatchReifier.java:50) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.CatchReifier.createProcessor(CatchReifier.java:30) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:812) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.TryReifier.createProcessor(TryReifier.java:46) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:835) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:576) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:236) ~[camel-core-reifier-3.8.0.jar:3.8.0]
... 26 common frames omitted
据我了解,这意味着 doCatch 块缺少其父块 (doTry)。我调试的时候,parent确实是null。
我是不是遗漏了什么,或者这是一个错误或更改 API?非常感谢!
此版本的 Apache Camel (https://issues.apache.org/jira/browse/CAMEL-16534) 中存在错误,已在 3.10.0 中修复。
从 Camel 3.8.0 开始,我无法在 XML 中配置 doCatch 块,如下所示:
<routes xmlns="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring.xsd">
<route>
<from uri="direct:start" />
<doTry>
<to uri="log:try" />
<doCatch>
<exception>java.lang.RuntimeException</exception>
<to uri="log:catch" />
</doCatch>
</doTry>
</route>
</routes>
我得到
Caused by: java.lang.IllegalArgumentException: This doCatch should have a doTry as its parent on DoCatch[ [class java.lang.RuntimeException] -> [To[log:catch]]]
at org.apache.camel.reifier.CatchReifier.createProcessor(CatchReifier.java:50) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.CatchReifier.createProcessor(CatchReifier.java:30) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.createProcessor(ProcessorReifier.java:812) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.TryReifier.createProcessor(TryReifier.java:46) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:835) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:576) ~[camel-core-reifier-3.8.0.jar:3.8.0]
at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:236) ~[camel-core-reifier-3.8.0.jar:3.8.0]
... 26 common frames omitted
据我了解,这意味着 doCatch 块缺少其父块 (doTry)。我调试的时候,parent确实是null。
我是不是遗漏了什么,或者这是一个错误或更改 API?非常感谢!
此版本的 Apache Camel (https://issues.apache.org/jira/browse/CAMEL-16534) 中存在错误,已在 3.10.0 中修复。