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