简体   繁体   中英

Configuring ActiveMq Failover broker URL in Camel CXF routing

I have an ActiveMq master slave setup and I want to use failover broker URI in camel route.

Following is my usecase:

 Webservice -> CXF -> ActiveMq

When I config the failover URI in spring config file I am getting invalid JMS URI error.

Following are the camel configuration file and soap fault string. Appriciate your help on this.

CamelConfig:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:cxf="http://camel.apache.org/schema/cxf"
    xsi:schemaLocation="
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
           http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">

    <bean id="basicAuthAuthorizationInterceptor" class="org.snaplogic.ws.BasicAuthAuthorizationInterceptor" />
    <bean id="responseBean" class="org.snaplogic.ws.ResponseBean" />
    <bean id="process" class="org.snaplogic.ws.ResponseProcess" />

    <cxf:cxfEndpoint id="runFlow"
        address="/Report/incident"
        wsdlURL="etc/WSCentralService.wsdl" serviceClass="org.snaplogic.wscentralservice.WSCentralService"
        bus="#cxf">
        <cxf:inInterceptors>
            <ref bean="basicAuthAuthorizationInterceptor" />
        </cxf:inInterceptors>
        <cxf:properties>
            <entry key="dataFormat" value="POJO" />
            <entry key="setDefaultBus" value="true" />
        </cxf:properties>
    </cxf:cxfEndpoint>

    <camelContext id="snaplogic" xmlns="http://camel.apache.org/schema/spring">
        <camel:propertyPlaceholder id="properties"
            location="classpath:incident.properties" />
        <route>
            <from uri="cxf:bean:runFlow" />
            <process ref="process" />
            <inOnly
                uri="activemq:queue:{{AmqQueue}}?brokerURL=failover:(tcp://{{AmqNode1IP}}:{{AmqPort}}, tcp://{{AmqNode1IP}}:61616)?maxReconnectAttempts=3" />
            <transform>
                <method bean="responseBean" method="getResponse" />
            </transform>
        </route>
    </camelContext>
</beans>

Soap fault Response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Invalid broker URI: failover:(tcp://xxxxxxx:61616, tcp://yyyyyyy:61616)</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

尝试删除代理URL字符串ergo中的空格:

uri="activemq:queue:{{AmqQueue}}?brokerURL=failover:(tcp://{{AmqNode1IP}}:{{AmqPort}},tcp://{{AmqNode1IP}}:61616)?maxReconnectAttempts=3" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM