我想建立一个Camel CXF endpont,并使SOAP响应与我的Camel Route的大部分异步。该路由将有许多处理步骤,我不希望在最后生成响应。
示例端点:
<cxf:cxfEndpoint id="someEndpoint"
address="/Service"
serviceClass="com.SomeImpl" />
示例路线:
public class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("cxf:bean:someEndpoint")
to("bean:processingStep1")
to("bean:replyToSOAP") // I would like to respond to cxf:cxfEndpoint here!
to("bean:processingStep2")
to("bean:processingStep3")
to("bean:processingStep4");
// The response to cxf:cxfEndpoint actually happens here.
}
}
我在MyRouteBuilder中尝试了很多选项来“分叉”进程(即bean:replyToSOAP):
我可以让路线步骤并行处理,但必须在生成响应之前完成所有步骤。
除了Claus在下面给出的答案之外,我想补充一点,wireTap的位置非常重要。使用:
.wireTap("bean:replyToSOAP")
无法获得所需的行为。会是什么:
public class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("cxf:bean:someEndpoint")
to("bean:processingStep1")
.wireTap("direct:furtherProcessing")
to("bean:replyToSOAP") // respond to cxf:cxfEndpoint here
from("direct:furtherProcessing") // steps happen independantly of beann:replyToSOAP
to("bean:processingStep2")
to("bean:processingStep3")
to("bean:processingStep4");
}
}