Accessing and Modifying Mule Events10% of the exam
Message attributes from listeners and operations
Where HTTP Listener, HTTP Request and File Read put their metadata in `attributes`, how to select URI parameters, repeated query parameters, hyphenated headers and the status code, and why a later operation or a Transform Message `set-attributes` replaces the attributes you saw earlier.
Apply correct processors/DataWeave expressions to access and modify Mule event attributes, and predict outcomes.
~7 min read · 7 practice questions ·
What the exam expects
- Read HTTP Listener request metadata with
attributes.uriParams,attributes.queryParams,attributes.headers,attributes.methodandattributes.requestPath, and tell URI parameters from query parameters. - Return every value of a repeated query parameter or header with the multi-value selector, and quote keys that are not valid identifiers such as
x-request-id. - Read HTTP Request response metadata (
attributes.statusCode) and File metadata (attributes.fileName,attributes.size). - Predict the attributes after a later operation or a Transform Message that sets attributes, and keep earlier attributes in a variable when they are needed later.
- Key terms: attributes (metadata of the message, read with
attributes); URI parameters (values captured by{param}placeholders in the listener path); query parameters (values after?, a multimap); multimap (map that allows several values per key); multi-value selector (.*key, returns all matching values as an array).
Key facts
Listener attributes
- Detail
- Method, request path, query, URI parameters and headers; the body is the payload
{param} placeholder- Detail
- Captures the path segment on the URI parameters map
Multimaps
- Detail
queryParamsandheaders;.returns the first value,.*all values
Raw query text
- Detail
attributes.queryString, separate fromattributes.queryParams
Non-identifier keys
- Detail
- Quote them:
attributes.headers.'content-type'
HTTP Request status
- Detail
attributes.statusCode; quoting the console labelStatus Codereturnsnull
File Read attributes
- Detail
attributes.fileName,attributes.size; no HTTP headers
Keeping attributes
- Detail
- Set Variable with
#[attributes]stores them for later components
Setting attributes
- Detail
- Transform Message
<ee:set-attributes>inside<ee:message>
default- Detail
- Supplies a value when a field is absent or
null
Sources for this section (5)
- Configure HTTP Listener Sourcedocs.mulesoft.com (opens in a new tab)
- Mule Message Structuredocs.mulesoft.com (opens in a new tab)
- Set Variable Transformerdocs.mulesoft.com (opens in a new tab)
- Transform Component XML Referencedocs.mulesoft.com (opens in a new tab)
- Set Default Values with DataWeavedocs.mulesoft.com (opens in a new tab)
- When does
attributes.listenerPathdiffer fromattributes.requestPath? - Why is the request body not where the HTTP Listener puts query parameters?
- How does
attributes.queryStringdiffer fromattributes.queryParams? - When does
defaultsupply a value in a DataWeave selector expression?
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 (7 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams