【问题标题】:Camel - CXF Endpoint - JMS Request-Reply modelCamel - CXF 端点 - JMS 请求-回复模型
【发布时间】:2014-11-08 03:38:40
【问题描述】:

我有 CXF 端点。我为每个操作定义了专用路由,并使用 header.operation 名称和收件人列表将请求路由到适当的路由。
对于几个操作(路由),我向 JMS 端点发布请求,该端点由另一个应用程序处理,并且在另一个队列中收到响应。我必须阅读响应消息并转换消息。我的请求线程(网络服务调用)将等待转换后的消息。
目前在发布请求后,目前我已经编写了自己的处理器,它使用 spring jms 模板来读取消息。我遇到了一些示例,例如拆分路由,但不确定它将如何用于 JMS 通信之间的整体同步通信。

【问题讨论】:

    标签: jms cxf apache-camel


    【解决方案1】:

    您可以在此处找到 JMX 请求/回复示例:

    <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
    </bean>
    
    <bean id="setResponseProcessor" class="org.apache.camel.itest.jetty.SetResponseProcessor"/>
    
    <camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
        <route>
            <from uri="cxf://serverBean"/>
            <to uri="jms:responseQueue"/>
        </route>
        <route>
            <from uri="jms:responseQueue"/>
            <process ref="setResponseProcessor"/>
        </route>
    </camelContext>
    

    【讨论】:

    • 这个例子看起来像是从同一个队列发送和读取。就我而言,我会将消息放入请求队列并等待具有相关 ID 的响应队列。
    • 上述答案将与设置为 responseQueue 的附加回复参数计量器一起使用。 Route 2 消息将到达回复队列,原始请求者线程将从回复队列中读取。例如''
    猜你喜欢
    • 2017-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-05
    • 1970-01-01
    • 1970-01-01
    • 2020-10-11
    • 1970-01-01
    相关资源
    最近更新 更多