Mule 3 Mulesoft Basics Mulesoft Tutorial

Understanding Various Mule Flows – Mulesoft Tutorial

Mulesoft / Mule EBS – Mule Flows Tutorial
Mule Flows


In this mule ESB tutorial we will understand various mule flows in detail with downloadable examples.

Various types of flows in mule


There are 4 types of flows in mule. While creating these flows the flow name should be unique in whole mule project despite beaning in different mule application XML file.

SubFlow


  1. Subflow always processes messages synchronously (relative to the flow that triggered its execution).
  2. Subflow executes in the same thread of the calling process. Calling process triggers the sub-flow and waits for it to complete and resumes once the sub-flow has completed.
  3. Subflow inherits processing strategy and exception handling strategy from the parent/calling flow.

Use – It can be used to split common logic and be reused by other flows.

Example:
Configuration – We have created 3 loggers in total, 2 in main/calling flow which is before and after flow reference and one in the sub flow.
subflow_flow
mulesubflow_flowreferenceconfig

Output:
mulesubflow_logs

Synchronous Flow

Same as sub-flow, the only difference is that in synchronous flows you need to separately define an exception strategy to it, it does not inherit the exception strategy of its calling flow.

Example:
flow
groovy
Output:
log

Asynchronous Flow


  1. As in sub-flow and synchronous flow, calling process triggers the sub-flow or synchronous flow and waits for it to complete; for asynchronous flow the flow, calling process triggers an asynchronous flow and moves ahead to its next activity.
  2. An asynchronous flow executes in parallel to its calling/parent flow in a different thread.
  3. An asynchronous flow does not return its output it its parent/calling flow.

standard_asynchronous

Example:
Configuration –
1. We have created 4 loggers in total, 2 in main/calling flow which is before and after flow reference (inside Async flow calling a sub-flow) and one in the sub flow.
Since sub-flow inherits processing strategy and exception handling strategy from the parent/calling flow, the sub flow will execute asynchronously.

flow

2. We have added a groovy script in the subflow to pause the thread executing it for 10 sec.
groovy
Output:
logs

Private Flow


Flow that does not have an inbound connector in the source. Means a private flow cannot start of its own on receiving the inbound message as it does not have any inbound connector, A private flow can only be called using flow-ref same as sub-flow.

Example:
private_flow

Varun Goel

About Varun Goel

Varun Goel is a technology enthusiast with 6+ years exp in IT industry. In fact, he is been developing application after schooling as freelancer. Currently working with one of the Fortune’s 100 Companies having vast experience Mule ESB, Tibco, HTML5, CSS, JSS, Android, Core Java, JSP, PHP, MySQL, AutoCAD, Maya, ZBrush, Photoshop, Flash CS and many more.

2 comments

Leave a Reply

Your email address will not be published.