[英]Camel, end rest-based route, returning from choice in loop
我正在尝试将错误处理添加到我的并行处理中:
...
.multicast(new GroupedMessageAggregationStrategy())
.parallelProcessing()
.to("direct:getAndSaveRoute1")
.to("direct:getAndSaveRoute2")
.end()
.split(body())
.choice()
.when(simple("${body.errorOcurred} == true"))
//TODO:: end route returning current body
.endChoice()
.otherwise()
.log(...)
.endChoice()
.end()
//after split, if no error occurred
.to("direct:nextRoute")
.end()
我似乎无法弄清楚如何在split
的choice
范围内返回/结束路线(并将当前主体作为 rest 响应主体传回)。 end()
和endRest()
似乎会引起问题......
也不清楚我需要多少个end()
; 为拆分添加一个end()
会导致异常并使 Spring 无法启动。
对于那些将来的人,我最终制作了一个 bean 来将列表变成一条消息,然后根据它进行choice
。
不是很“骆驼”,但需要包裹起来
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.