2014-06-19 37 views
0

我有一個項目,我在其中創建了10個流程。 其中,8個流與不同的隊列連接。此外,我正在使用Java轉換器進行一些轉換並將轉換後的文件放在某個文件夾中騾子問題,如果在一個項目中有多個流程

Noe問題是所有10個流都在同一時間觸發。如果兩個隊列正在傳遞一些數據,則會同時觸發相應的兩個流。我只想在第一次流程停止時觸發另一個流程,因爲在那裏應用了一個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> 

+0

我認爲你需要發佈你的xml配置文件中描述的所有內容 – secario

+0

我在問題本身附加了XML – user3675877

回答

0

使用 '初始化狀態' 屬性。

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

該屬性的默認值是initialstate =「started」。

+0

Kk ..然後流程如何被觸發?一旦它被觸發,對於下一個輸入,情況將再次發生 – user3675877

+0

如果你的問題是使用同一個java類的多個線程/流..使用java的同步概念。 – tortoise

+0

參考這個答案啓動/停止流程http://stackoverflow.com/questions/15387745/how-to-stop-a-mule-flow-from-running-after-startup – tortoise

相關問題