使用Web服务集成ActiveMQ服务(Mule ESB)

时间:2014-07-19 11:20:25

标签: java eclipse web-services jms mule

我只想将我的网络服务数据发送到ActiveMQ。 问题是没有创建队列,并且没有将消息发送到该队列。这是我的代码:

    <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
    <spring:beans>
        <spring:bean id="objectStore" class="org.mule.util.store.SimpleMemoryObjectStore"/>
    </spring:beans>

    <flow name="test_mq_externalwebserviceFlow1" doc:name="test_mq_externalwebserviceFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" doc:name="HTTP"/>
        <cxf:jaxws-service serviceClass="com.org.RequestHandlerService" doc:name="SOAP"/> 
        <until-successful objectStore-ref="objectStore" maxRetries="5" secondsBetweenRetries="10" doc:name="Until Successful" deadLetterQueue-ref="retryFlow">
            <component class="com.org.ReverseName" doc:name="JavaMain_ServiceImpl"/> 
        </until-successful>
        <logger level="INFO" doc:name="Logger"/>
        <echo-component doc:name="Echo"/>
        <jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="errorQueue"/>
        <catch-exception-strategy doc:name="Catch Exception Strategy">
            <jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="errorQueue"/>
        </catch-exception-strategy>
    </flow> 

1 个答案:

答案 0 :(得分:0)

在JMS出站端点之前使用Object to XML Transformer并在Java组件之后删除Jms端点......如下所示: -

<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/><spring:beans>
<spring:bean id="objectStore" class="org.mule.util.store.SimpleMemoryObjectStore"/</spring:beans><flow name="test_mq_externalwebserviceFlow1" doc:name="test_mq_externalwebserviceFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.org.RequestHandlerService" doc:name="SOAP"/> 
<until-successful objectStore-ref="objectStore" maxRetries="5" secondsBetweenRetries="10" doc:name="Until Successful" deadLetterQueue-ref="retryFlow">
<component class="com.org.ReverseName" doc:name="JavaMain_ServiceImpl"/> 
</until-successful>
<logger level="INFO" doc:name="Logger"/>

<catch-exception-strategy doc:name="Catch Exception Strategy">
  <mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<jms:outbound-endpoint connector-ref="Active_MQ" doc:name="JMS" queue="errorQueue"/>
</catch-exception-strategy>

现在每当出现异常时......请求将发送到ActiveMQ