understanding flow and subflow with mulesoft
TRANSCRIPT
INTRODUCTION
Mule Application basically contains one or more flows. Mule flow start processing the message when it is received
by inbound endpoints. This flow either contains all the processing stages or route the message to other flow or sub
flow to perform specific task. Mule flow can be synchronous or asynchronous flow. Subflow is always
synchronous.
Advantages of Mule Flow
• Asynchronous triggered flow can perform time consuming task such as a writng a bulk data to database or
emailing a message without stalling the execution of triggering flow. Triggering flow and Asynchronous
triggered flow both can be executed in parallel.
• You can break up complex flow into various flow or subflow which can be intitutive or easy to read.
• Processing actions in a flows or subflows can be called and used by multiple flows in an application. You can
achieve code reusability.
SUBFLOWSubflow always process the message synchronously and always inherits the processing as well as exception strategy
from triggering flow. During subflow running, processing on triggering flow stalls till the subflow completes the processing
and handover the message to triggering flow.
• Subflow is best suited for code reuse, so you can write the block of code once within subflow and it can be triggered
by any flow within same application.
• You are breaking a flow into various subflow and which make GUI view intituitive and xml easy to read.
• Subflow inherits processing as well as exception strategy from triggering flow, so you don't have to implement
separate processing and exception strategy for sub flow.
SYNCHRONOUS FLOWSynchronous flow is similar to Subflow, during triggered synchronous flow running, processing on triggering flow stalls
till triggered flow completes the processing and handover the message to triggering flow. Synchronous Flow doesn't
inherits the processing and exception strategy from triggering flow. This type of flow process the message within single
thread. Flow Reference can be used to invoke other flow.
ASYNCHRONOUS FLOWAsynchronous Flow process the message in parallel to triggered and triggering flow. Flow passes the message to
asynchronous flow thus triggering this flow. At same time triggering flow sends copy of message to another processor of
its own flow. So, triggering and triggered flow execute simultaneously and independently of each other. Asynchronous
Flow doesn't inherits the processing and exception strategy from triggering flow. This type of flow process the message
within multiple thread. For Asynchronous flow, Flow Reference must be wrapped with Async Scope in triggering flow.