# Flow Reference, subflows and VM queues

*MuleSoft Developer Study Guide · Structuring Mule Applications · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/structuring-mule-applications/flow-reference-subflows-and-vm-queues*

How events move between flows: Flow Reference runs a flow or subflow synchronously and returns the event, subflows are inlined at build time, VM Publish and Publish Consume hand content through transient or persistent queues (also across apps in one domain), and the Async scope fires and forgets a copy of the message.

- Certification: Salesforce MuleSoft Developer
- Exam section: Structuring Mule Applications
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Specify when and how to pass events between flows and subflows using connectors and flow references, and predict outcomes.

## What the exam expects

- Choose between Flow Reference, VM Publish, VM Publish Consume and an Async scope from whether the caller must wait, needs the result, needs a queue or crosses apps.
- Decide between a flow and a subflow, and predict what breaks when a subflow holding a Batch Job is referenced twice.
- Predict the payload, variables and errors after a Flow Reference, with and without a `target`.
- Predict VM outcomes: listener attributes, the Publish Consume reply, timeouts, errors and persistence.
- Key terms: **Flow Reference** (synchronous call that routes the event to a flow or subflow and back); **subflow** (a sourceless, handler-less group of processors inlined where referenced); **VM queue** (a transient or persistent in-runtime queue created by a VM Listener); **Publish Consume** (VM operation that publishes and waits for a reply); **Async scope** (fire-and-forget branch working on a copy of the message).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Flow Reference scope | Same Mule application only; synchronous; returns the event | [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about) |
| Target on error | Target variable is not set | [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about) |
| Subflow | No source, no error handler; inlined at build time | [Flows and Subflows](https://docs.mulesoft.com/mule-runtime/latest/about-flows) |
| Batch Job in a subflow referenced twice | Deployment fails: duplicate job instance ID | [Flows and Subflows](https://docs.mulesoft.com/mule-runtime/latest/about-flows) |
| VM Queue type default | `TRANSIENT` | [VM Connector Reference](https://docs.mulesoft.com/vm-connector/latest/vm-reference) |
| VM Listener consumers default | 4 | [VM Connector Reference](https://docs.mulesoft.com/vm-connector/latest/vm-reference) |
| VM Message Attributes | Queue Name and Timestamp only | [VM Connector Reference](https://docs.mulesoft.com/vm-connector/latest/vm-reference) |
| Persistent queue data | Must be serializable | [VM Connector](https://docs.mulesoft.com/vm-connector/latest/) |
| Receiving flow fails under Publish Consume | `VM:PUBLISH_CONSUMER_FLOW_ERROR`, original description | [VM Publish and Get a Response Example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-response) |
| VM between apps | Both apps in the same domain | [VM Send Messages across Apps Example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-across-apps) |

## Check yourself

- Why does an error thrown inside an Async scope not reach the main flow's error handler?
- When is the temporal reply-To queue of a Publish Consume created and removed?
- What does a Max Outstanding Messages value of `0` mean?
- Where does a persistent VM queue keep its contents on a single instance and in a cluster?

## Sources

- [Flow Reference Component](https://docs.mulesoft.com/mule-runtime/latest/flowref-about)
- [Flows and Subflows](https://docs.mulesoft.com/mule-runtime/latest/about-flows)
- [Flow and Subflow Scopes](https://docs.mulesoft.com/mule-runtime/latest/flow-component)
- [VM Connector](https://docs.mulesoft.com/vm-connector/latest/)
- [VM Connector Reference](https://docs.mulesoft.com/vm-connector/latest/vm-reference)
- [VM Publish and Listen Example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-listen)
- [VM Publish and Get a Response Example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-response)
- [VM Propagate Message Attributes Example](https://docs.mulesoft.com/vm-connector/latest/vm-propagate-messages)
- [VM Send Messages across Apps Example](https://docs.mulesoft.com/vm-connector/latest/vm-publish-across-apps)
- [Async Scope](https://docs.mulesoft.com/mule-runtime/latest/async-scope-reference)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 13 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Developer pack (USD $19): https://www.certifyforce.com/practice-exams
