1
我想建立一个Camel CXF endpont,并且使SOAP响应与我的大部分骆驼路由异步。该路线将有很多处理步骤,我不想在最后产生响应。骆驼CXF异步请求和回复
一个例子端点:
<cxf:cxfEndpoint id="someEndpoint"
address="/Service"
serviceClass="com.SomeImpl" />
一个例子路线:(:replyToSOAP即豆):
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为 “叉” 的过程中尝试了许多选项
- .multicast()。parallelProcessing()
- In-memory异步消息(“seda”和“vm”)
- 我没有试过JMS。我想要做的事情可能会过度。
我能得到的路线步骤并行处理,但会产生反应之前,必须完成所有步骤。
除了克劳斯在下面给出的答案之外,我想补充一点,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");
}
}
谢谢你,这就是我要找的。 – DKerr