Camel JMS CXF端点不会创建新的临时应答队列

时间:2014-03-18 21:50:52

标签: soap jms cxf apache-camel jbossfuse

我有两个使用JMS作为传输的CXF端点;一个用作消费者,第二个用作生产者。这是一个非常精简的设置。

<camelcxf:cxfEndpoint xmlns:i="http://inbound.com/inbound"
                      id="myInboundEndpoint"
                      endpointName="i:InboundService"
                      serviceName="i:InboundService"
                      address="camel://direct:my-inbound-route"
                      serviceClass="com.InboundService"
                      bus="cxf"
                      wsdlURL="classpath:META-INF/wsdl/inbound.wsdl">
    <camelcxf:properties>
        <entry key="dataFormat" value="POJO"/>
    </camelcxf:properties>
</camelcxf:cxfEndpoint>

<camelcxf:cxfEndpoint xmlns:o="http://outbound.com/outbound"
                      id="myOutboundEndpoint"
                      endpointName="o:OutboundService"
                      serviceName="o:OutboundService"
                      address=""jms://"" 
                      serviceClass="com.OutboundService"
                      bus="cxf"
                      wsdlURL="classpath:META-INF/wsdl/outbound.wsdl">
    <camelcxf:properties>
        <entry key="dataFormat" value="POJO"/>
    </camelcxf:properties>
    <camelcxf:features>
        <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
            <property name="jmsConfig" ref="jmsConfig" />
        </bean>
    </camelcxf:features>
</camelcxf:cxfEndpoint>

<bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration">
    <property name="connectionFactory" ref="pooledConnectionFactory" />
    <property name="targetDestination" value="some-queue" />
</bean>

<camelContext>
    <route id="inQueue">
        <from uri="activemq:inbound-queue" />
        <to uri="direct:my-inbound-route" />
    </route>
    <route id="inVm">
        <from uri="direct:in-vm" />
        <to uri="direct:my-inbound-route" />
    </route>
    <route id="serviceProxy">
        <from uri="cxf:bean:myInboundEndpoint?synchronous=true" />
        <setHeader headerName="operationName"><constant>myOtherOperation</constant></setHeader>
        <to uri="cxf:bean:outboundEndpoint?synchronous=true" />
    </route>        
</camelContext>

但是,当调用第二个路由时,CXF组件或camel会尝试从原始入站消息(包括应答队列)重新使用所有JMS配置,而不是仅为此交换创建另一个临时应答队列。这似乎是从消息中的标题。

如果您只是使用纯JMS并将CXF排除在等式之外,那么camel正确地为路径的内部部分创建了一个新队列,尽管我需要继续使用CXF,因为有一些遗留拦截器我受限制使用。

我尝试过使用jms:// + JMSConfig样式以及camel:// style。

我目前正在使用jaxws:client方法,只使用bean:myBean?method = myMethod引用,但是它不允许我从原始入站方法传播SOAP标头,因此切换到使用cxf:endpoint而不是

我试图找到一个使用CXF使用SOAP over JMS的例子,似乎没有具体的例子。

所以问题是......是否需要为我的制作人做任何其他配置,或者是否有其他方法我可以使用CXF对JMS进行SOAP并从原始消息/ camel交换中传播/设置一些头文件?

1 个答案:

答案 0 :(得分:1)

我认为你可能需要从inMessage中过滤replyTo的标题。

如果要使用SOAP over JMS,可以在不破解JMSConfiguration的情况下在地址上指定所有与JMS相关的设置。以下是您可以作为示例的document