What is the difference between async scope and sub flow in Mule 4?

Async scope in Mule 4:
Async scope is a part of main flow. The main flow continues to process while it triggers and process the Async scope. The aysnc scope flow do not impact the process of main flow. The message received by previous processor(main flow) is sent to async scope and also to the next processor of the async scope. So, parallel execution of aynsc scope and main flow is achieved.
Subflow in Mule 4:
A subflow is a scope that enables you to group event processors in a manner similar to that of a flow. Subflows do not have event sources and error handling scope. Referencing subflows results in better performance than referencing a flow.
Differences between async scope and sub-flow Mule 4:
- Async scope does not use the exception strategy of the main flow. Sub flow uses its parent flow's exception strategy.
- To handle errors in an Async scope, you should use the Try scope in Mule 4.
- The messages in async scope are processed asynchronously.
- No data is returned to the main flow after processing.
- Async scope exists inline with the main flow thread.
- Here, Flow Reference component cannot be used to call async scope. We use Flow reference to refer a sub flow.
- This scope cannot be reused or referenced else where.
1 Comments
Thanks for sharing a useful information..
ReplyDeleteMulesoft Online Training
Mulesoft Training