当它们被抛出多播时,Camel不会传播异常.
鉴于以下设置direct:route从beanRef抛出异常:
rest("/...")
.post()
.consumes("application/json")
.produces("application/json")
.route()
.onException(Exception.class)
.handled(true)
.bean("exceptionHandler")
.marshal("exceptionDataFormat")
.end()
.unmarshal("dataFormat")
...
.enrich("direct:services", new ServiceAggregator())
.to("direct:anotherRoute")
...
.end()
.endRest();
from("direct:services")
.errorHandler(noErrorHandler())
.multicast()
.setAggregationStrategy(new GroupedExchangeAggregationStrategy())
.executorServiceRef("executor")
.parallelAggregate()
.streaming()
.stopOnException()
.to("direct:route")
.end()
.end();
from("direct:route")
.errorHandler(noErrorHandler())
.bean("someRef", "someMethod")
.end();
Run Code Online (Sandbox Code Playgroud)
我没有允许异常处理程序使用交换并处理错误,而是立即返回以下异常(到SoapUI):
org.apache.camel.CamelExchangeException: Parallel processing failed for number 0. Exchange[...] at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:328)
at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:299)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)
并且父路由以该异常结束并且没有异常处理.
如果direct:anotherRoute要抛出异常,则正确处理该异常.
为什么我不能将多播异常传播到父路由?
骆驼2.17-SNAPSHOT
打开shareUnitOfWork多播上的选项.有关详细信息,请访问:http://camel.apache.org/multicast,有一个关于拆分器的示例,它也有此选项:http://camel.apache.org/splitter.html
| 归档时间: |
|
| 查看次数: |
2146 次 |
| 最近记录: |