开发者

Apache Camel multicast, exception and Aggregation strategy

I define a complex route in which I had to to orchestrate different simple operations.

   from(cxfCartEndpoint).routeId("receiveCart")
    .to("log:com.sdmo.input?level="+LOG_LEVEL)
    .process(cartWSExtractProcessor)
    .to(loggingMesssagesPath+"?fileName=originalRequest${date:now:yyyyMMdd-HHmmss}.xml")
    .multicast(aggregationStrategy).stopOnException()
       .to("mock:doNothing","direct:copyItem","direct:XmlSave","direct:manageFinalResponse")
        .end()
     .to(loggingMesssagesPath+"?fileName=finalResponse${date:now:yyyyMMdd-HHmmss}.xml")
     .process(new ConvertCartResponseProcessor())
     .to("log:com.sdmo.output?level="+LOG_LEVEL)
     ;

The from endpoint is a cxf WS in POJO mode, and I need to keep his header to be able to proceed the response, so the purpose of my aggregation strategy is to keep the original header. I set the .stopOnException() option be开发者_如何学Gocause I do not want to run step 2 if step 1 is not ok. I throw exception with the following way in subroutes :

.choice()
  .when(not(successResponsePredicate))
    .to("log:com.sdmo.Error?level="+LOG_LEVEL)
    .throwException(new Exception("copyItemError"))
  .otherwise()
    .to("mock:CopyItemSuccess")
 .end();

Now I want to handle the exception in the aggregation strategy and compute a suitable error message to my web-service response.

If I define an exception behavior with the onException the exchange does not return to the aggregation strategy, I think I had to remove the stopOnException option, but I don't know how configure my aggregation strategy to skip the following multicast step

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜