What is the difference between a Flow and a Sub-flow in Mule 4?
Suggested answer
Flow: Has a source (trigger — HTTP Listener, scheduler, queue consumer, etc.) and an error handling section. Can be called from other flows using the Flow Reference component. Has its own error handling scope — errors propagate to the flow's error handler. Sub-flow: No source component — can only be called from a Flow Reference in another flow or sub-flow. No error handling section — errors in a sub-flow propagate up to the calling flow's error handler (or the default error handler). This is the critical difference: a sub-flow participates in the calling flow's transaction and error handling context; a flow with an error handler isolates errors. Use sub-flows for reusable logic without independent error handling; use flows when you need isolated error handling or a separate trigger source.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.