【问题标题】:Camel CXF asynchronous request and replyCamel CXF 异步请求和回复
【发布时间】:2013-07-15 10:02:58
【问题描述】:

我想设置一个 Camel CXF 端点,并使 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):

  1. .multicast().parallelProcessing()
  2. 内存中异步消息传递(“seda”和“vm”)
  3. 我没有尝试过 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");
    }
}

【问题讨论】:

    标签: cxf apache-camel


    【解决方案1】:

    有一个 WireTap EIP,它可以独立于当前路由来旋转要处理的消息副本:http://camel.apache.org/wire-tap

    【讨论】:

    • 谢谢,这正是我要找的。​​span>
    猜你喜欢
    • 2017-11-16
    • 2014-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-19
    • 2021-02-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多