2
Mule中的Subflow和處理器鏈有什麼區別?Mule Subflow vs處理器鏈
據我所用,兩者都是可重複使用的。兩者都使配置更具可讀性。兩者都同步執行。兩者都從觸發流程中繼承處理策略和異常策略。
處理器鏈可以在流內部定義,也可以在全局消息處理器中定義。
除此之外,它們在行爲和用法上有何不同。
更新: 實施例的配置具有命名處理器鏈
<flow name="man-flow" >
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="myapp/collection-processor" doc:name="HTTP">
<byte-array-to-string-transformer></byte-array-to-string-transformer>
</http:inbound-endpoint>
<expression-component doc:name="Expression"><![CDATA[java.util.ArrayList list = new java.util.ArrayList();
list.add("First String");
list.add("Second String");
list.add("Third String");
payload = list;]]>
</expression-component>
<request-reply>
<vm:outbound-endpoint path="split"/>
<vm:inbound-endpoint path="processed"/>
</request-reply>
<set-payload value="#[payload.toString()]"/>
</flow>
<processor-chain name="sample-processor-chain">
<append-string-transformer message=" in splitter" />
<append-string-transformer message=" in processor-chain" />
</processor-chain>
<flow name="splitter-flow">
<vm:inbound-endpoint path="split"/>
<collection-splitter enableCorrelation="IF_NOT_SET"/>
<processor ref="sample-processor-chain"></processor>
<vm:outbound-endpoint path="aggregate"/>
</flow>
<flow name="aggregator-flow">
<vm:inbound-endpoint path="aggregate"/>
<collection-aggregator timeout="30000"/>
<vm:outbound-endpoint path="processed"/>
</flow>