Mule问题如果多个流在一个项目中

时间:2014-06-19 07:09:48

标签: mule

我有一个项目,其中我创建了10个流程。 其中,8个流与不同的队列连接。我正在使用java变换器进行一些转换,并将转换后的文件放在某个文件夹中。

Noe问题是所有10个流量同时触发。如果2个队列正在包含某些数据,则会同时触发相应的两个流。我想在第一个流停止时触发另一个流,因为在那里应用了一个commom java类,因为我没有得到确切的结果。

我没有流依赖。这就是为什么,我不能使用流程参考。另外,我使用处理策略作为最大1个线程,因为我需要从一个队列逐个处理消息。

帮我解决这个问题。这是我的XMl

      <queued-asynchronous-processing-strategy name="allowOneThread" maxThreads="1" doc:name="Queued Asynchronous Processing Strategy" threadWaitTimeout="2000"/>
<spring:beans>
      <context:property-placeholder location="classpath:mule-app.properties" />
 </spring:beans>
       <wmq:connector name="WMQ" hostName="${wmq.hostname}" port="${wmq.port}" queueManager="${wmq.queue.manager}" username="${wmq.username}" password="${wmq.password}" validateConnections="true" doc:name="WMQ" channel="${wmq.channel}"/>
         <file:connector name="File" autoDelete="false" streaming="true" validateConnections="true" doc:name="File" pollingFrequency="20000"/>
       <flow name="CatalogueFlow_AB" doc:name="CatalogueFlow_AB" processingStrategy="allowOneThread">

    <wmq:inbound-endpoint queue="${wmq.queue.nameCT_AB}" doc:name="WMQ" connector-ref="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.catalog.ServiceController_AB" doc:name="Java"/>
    <logger level="INFO" doc:name="CAT Logger" category="Audit_LogCAT" message="******************Entered Catalogue SOAP File with Province Name AB is Processed from queue*********"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger level="INFO" doc:name="CAT Exception Logger" category="Audit_LogCAT" message="*******************************Entered Catalogue SOAP File with Province Name AB is having error: #[exception.causeException]****************"/>
    </catch-exception-strategy>
</flow>
<flow name="CatalogueFlow_BC" doc:name="CatalogueFlow_BC" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameCT_BC}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.catalog.ServiceController_BC" doc:name="Java"/>
    <logger message="******************Entered Catalogue SOAP File with Province Name BC is Processed from queue*********" level="INFO" category="Audit_LogCAT" doc:name="CAT Logger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered Catalogue SOAP File with Province Name BC is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogCAT" doc:name="CAT Exception Logger"/>
    </catch-exception-strategy>
</flow>
<flow name="CatalogueFlow_ON" doc:name="CatalogueFlow_ON" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameCT_ON}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.catalog.ServiceController_ON" doc:name="Java"/>
    <logger message="******************Entered Catalogue SOAP File with Province Name ON is Processed from queue*********" level="INFO" category="Audit_LogCAT" doc:name="CAT Logger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered Catalogue SOAP File with Province Name ON is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogCAT" doc:name="CAT Exception Logger"/>
    </catch-exception-strategy>
</flow>
<flow name="CatalogueFlow_MB" doc:name="CatalogueFlow_MB" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameCT_MB}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.catalog.ServiceController_MB" doc:name="Java"/>
    <logger message="******************Entered Catalogue SOAP File with Province Name MB is Processed  from queue*********" level="INFO" category="Audit_LogCAT" doc:name="CAT Logger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered Catalogue SOAP File with Province Name MB is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogCAT" doc:name="CAT Exception Logger"/>
    </catch-exception-strategy>
</flow>
<flow name="InterchangablePriority_AB" doc:name="InterchangablePriority_AB" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameIP_AB}" doc:name="WMQ" connector-ref="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.interchangeablePriority.IPController_AB" doc:name="Java"/>
    <logger level="INFO" doc:name="IP Logger" category="Audit_LogIP" message="******************Entered IP SOAP File with Province Name AB is Processed from queue*********"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger level="INFO" doc:name="IP Exception Logger" category="Audit_LogIP" message="*******************************Entered IP SOAP File with Province Name AB is having error: #[exception.causeException]****************"/>
    </catch-exception-strategy>
</flow>
<flow name="InterchangablePriority_BC" doc:name="InterchangablePriority_BC" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameIP_BC}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.interchangeablePriority.IPController_BC" doc:name="Java"/>
    <logger message="******************Entered IP SOAP File with Province Name BC is Processed from queue*********" level="INFO" category="Audit_LogIP" doc:name="IP Logger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered IP SOAP File with Province Name BC is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogIP" doc:name="IP Exception Logger"/>
    </catch-exception-strategy>
</flow>
<flow name="InterchangablePriority_ON" doc:name="InterchangablePriority_ON" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameIP_ON}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.interchangeablePriority.IPController_ON" doc:name="Java"/>
    <logger message="******************Entered IP SOAP File with Province Name ON is Processed from queue*********" level="INFO" category="Audit_LogIP" doc:name="IP Logger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered IP SOAP File with Province Name ON is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogIP" doc:name="IP Exception Logger"/>
    </catch-exception-strategy>
</flow>
<flow name="InterchangablePriority_MB" doc:name="InterchangablePriority_MB" processingStrategy="allowOneThread">
    <wmq:inbound-endpoint queue="${wmq.queue.nameIP_MB}" connector-ref="WMQ" doc:name="WMQ"/>
    <object-to-string-transformer doc:name="File Mapping"/>
    <custom-transformer class="com.tcs.sdm.kcm.interchangeablePriority.IPController_MB" doc:name="Java"/>
    <logger message="******************Entered IP SOAP File with Province Name MB is Processed from queue*********" level="INFO" category="Audit_LogIP" doc:name="IPLogger"/>
    <catch-exception-strategy doc:name="Catch Exception Strategy">
        <logger message="*******************************Entered IP SOAP File with Province Name MB is having error: #[exception.causeException]****************" level="INFO" category="Audit_LogIP" doc:name="IP Exception Logger"/>
    </catch-exception-strategy>
</flow>

1 个答案:

答案 0 :(得分:0)

使用&quot; initialState&#39;流的属性。

<flow name="InterchangablePriority_MB" initialState="stopped">
...
</flow>

此属性的默认值为initialstate =&#34;已启动&#34;。