Transforming Data10% of the exam
Calling flows with the DataWeave lookup function
How `lookup(flowName, payload, timeoutMillis)` runs a flow from a DataWeave script: it calls flows but not subflows, passes and returns only a payload, times out after 2000 ms on CPU_LIGHT or CPU_INTENSIVE threads, and must not have side effects, which is why MuleSoft recommends a Flow Reference with a target variable instead.
Call Mule flows from a DataWeave script.
~5 min read · 3 practice questions ·
What the exam expects
- Write a
lookupcall that runs a flow from a DataWeave script and predict the value it returns. - Recognise that
lookupcannot call a subflow, and that it passes and returns only a payload. - Apply the
timeoutMillisdefault and know that exceeding it raises an error. - Recommend a Flow Reference with a
targetvariable when the called flow has side effects or is called per item. - Key terms: lookup (dw::Mule function that executes a flow by name and returns its payload); dw::Mule (DataWeave module of functions that interact with the Mule runtime); Flow Reference (component that routes the whole event to a flow or subflow and back); target variable (Flow Reference setting that stores the result in a variable and leaves the message unchanged); side effect (an action such as writing a record that changes something outside the returned value).
Key facts
Signature
- Detail
lookup(flowName: String, payload: Any, timeoutMillis: Number = 2000)
Module
- Detail
dw::Mule, withcausedByandp
Minimum runtime
- Detail
- Mule 4.1.4 and later
Subflows
- Detail
lookupdoes not support calling subflows
Input
- Detail
- Only the payload, no attributes or variables
Output
- Detail
- Only the called flow's payload
Timeout default
- Detail
- 2000 ms on CPU_LIGHT or CPU_INTENSIVE threads, 1 minute otherwise; exceeding it raises an error
Status
- Detail
- Deprecated; Flow Reference with
targetis recommended
Flow Reference reach
- Detail
- Routes the event to a flow or a subflow
- When does
lookupraise a timeout error on a CPU_LIGHT thread if notimeoutMillisis given? - When do the payload and variable changes made in a referenced flow persist after a Flow Reference?
- What does the documented
Mule::lookup('flow2', {test:'hello '})return toflow1's script? - Which minimum Mule runtime version supports
lookup?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the MuleSoft Developer pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 40 lessons of the MuleSoft Developer guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Practice exams purchase adds inline bank questions and topic practice (3 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams