Mule Subflow vs Processor-Chain

What is the difference between Subflow and Processor-Chain in Mule?

As far as I've used, both are reusable. Both make the configuration more readable. Both run synchronously. Both inherit the processing strategy and the exclusion strategy from the startup thread.

The target chain can be defined within a thread as well as for the global message processor.

Also, how they differ in terms of behavior and use.

Update: Example configuration with a named cpu 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>

      

+3


source to share


1 answer


processor-chain

was created to address the issue of some message handlers allowing no more than one nested processor. The idea sub-flow

is a macro decomposition of a series of message processors. If you are using the Mule lattest versions, you shouldn't use CPU chaining too much, except for some really old designs. Using substreams allows you to have much more readable code, such as including repetitive content.



+4


source







All Articles