队列是否可以直接以发布 - 订阅模式从主题中消耗

时间:2014-04-28 06:15:28

标签: mule

队列是否可以直接在发布 - 订阅模式下从主题中消耗。有人可以为此提供指针。我使用websphere MQ作为JMS代理。应该使用Mule配置进行设置。

骡子配置

testTopic10是主题名称 testQueue10是队列名称

                                 
             

<!-- Publisher Flow -->
<flow name="PublisherFlow" doc:name="PublisherFlow">
    <file:inbound-endpoint path="c:\retryin" responseTimeout="10000" doc:name="File"/>
    <object-to-string-transformer doc:name="Object to String"/>
    <jms:outbound-endpoint topic="testTopic10" doc:name="JMS" connector-ref="WMQ_Pub_Topic_Connector"/>
</flow>

<!-- Transfer from topic to Queue -->
<flow name="SubscriberFlowQueueTransfer" doc:name="SubscriberFlowQueueTransfer">
    <jms:inbound-endpoint topic="testTopic10" connector-ref="WMQ_Pub_Topic_Connector" doc:name="JMS">
    </jms:inbound-endpoint>
    <logger message="Entered Subscriber Queue transfer" level="INFO" doc:name="Logger"/>
    <jms:outbound-endpoint queue="testQueue10" connector-ref="WMQ_Sub_Queue_Connector" doc:name="JMS">
    </jms:outbound-endpoint>
</flow>

<!-- Subscriber Flow -->

<flow name="SubscriberFlowQueue" doc:name="SubscriberFlowQueue">
    <jms:inbound-endpoint queue="testQueue10" connector-ref="WMQ_Sub_Queue_Connector" doc:name="JMS">
        <jms:transaction action="ALWAYS_BEGIN" timeout="3000"/> 
    </jms:inbound-endpoint>
    <logger message="Entered subscriber flow" level="INFO" doc:name="Logger"/>
    <ftp:outbound-endpoint host="XXX.XXX.XX.XX" port="21" path="path" user="test" password="test123" responseTimeout="10000" doc:name="FTP"/>
    <rollback-exception-strategy  doc:name="Rollback Exception Strategy" enableNotifications="false"/>
</flow>

连接器配置

<jms:connector  name="WMQ_Pub_Topic_Connector" specification="1.1" validateConnections="true" connectionFactory-ref="WebSphereMQConnectionFactory" doc:name="JMS" durable="true" clientId="mule-server-01" persistentDelivery="true" maxRedelivery="5">
     <reconnect-forever frequency="5000" />
</jms:connector>
<jms:connector name="WMQ_Sub_Queue_Connector" specification="1.1" validateConnections="true" connectionFactory-ref="WebSphereMQConnectionFactory" doc:name="JMS" durable="true" clientId="mule-server-01" persistentDelivery="true" maxRedelivery="5">
    <receiver-threading-profile maxThreadsActive="1"/>   
    <reconnect-forever/>
</jms:connector>

1 个答案:

答案 0 :(得分:0)

这很简单,您可以查看WebSphere MQ transpor documentationWebShphere MQ example。但基本上你需要:

  1. 配置WMQ连接器

    <wmq:connector name="wmqConnector" hostName="${wmq.host}" port="${wmq.port}" queueManager="${wmq.queue.manager}" username="${wmq.username}" password="${wmq.password}" />
    
  2. 使用端点

    创建流程
    <flow name="MessageProcessor">
        <wmq:inbound-endpoint connector-ref="wmqConnector" queue="topic.in">
        ...
    </flow>
    
  3. 将MQ jar添加到MULE_HOME / lib / user

    • com.ibm.mq.jar
    • com.ibm.mqetclient.jar(如果使用远程XA事务)
    • com.ibm.mq.jmqi.jar
    • com.ibm.mqjms.jar
    • dhbcore.jar