What is the difference between Subflow and Processor-Chain in Mule?
As far as I have used both are re-usable. Both makes the config more readable. Both execute synchronously. Both inherit the processing strategy and exception-strategy from the triggering flow.
Processor-chain can be defined inside the flow as well as a global message processor.
Apart from this how are they different in terms of behaviour and usage.
Update: Example config with Named Processor Chain
<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>