Context Objects | Field | Description |
---|---|---|
server |
dateTime env fileSeparator host ip locale javaVersion javaVendor nanoSeconds osName osArch osVersion systemProperties timeZone tmpDir userName userHome userDir |
The operating system on which the message processor is running. |
mule |
clusterId home nodeId version |
The Mule instance on which the application is running. |
application |
encoding name standalone workDir registry |
The user application within which the current flow is deployed. |
message |
id rootId correlationId correlationSequence correlationGroupSize replyTo dataType payload inboundProperties inboundAttachments outboundProperties outboundAttachments |
The package (payload, attachments, properties) that the message processor is processing. |
Variables | Field | Description |
---|---|---|
flowVars | N/A | A flow variable set on the message; flow variables persist only within the flow in which they were created. |
sessionVars | N/A | A session variable set on the message; session variables persist across flows within an application. |
Example | Description | |
---|---|---|
#[ ] | #[message.id] | Always bounds an expression. |
Simple expressions |
[message.field] [sessionVars.age] |
The simplest type of expression, these consist of just a context object and a field, or simply a variable. |
Multi line expressions | #[calendar = Calendar.getInstance(); message.payload = ``new org.mule.el.datetime.DateTime(calendar);] | You can include several lines in a single expression, each must end with a ; |
Operators | #['Cookie' + flowVars.cookie] | Performs operations in expressions. Can be unary, comparison, logical, bitwise, arithmetic, and more. |
Boolean expressions |
#['foo'=='bar'] #[2 + 2 == 4] |
Produces Boolean values. |
Bean Property Access | #[payload.property1.property2] | Access information from bean. |
Method invocations | #[message.header.get()] | Calls a method, then performs it on an object according to the parameter (if any) specified within the parentheses. Method calls always follow the syntax: object.method(). |
Assignments | #[payload = 'sample'] | Evaluates to assign a value. The example at left resolves dynamically to set the payload to sample. |
Literals |
'expression' 255 null |
Strings, numbers, Boolean values, types, and nulls. |
xpath and regex | xpath3('/orders/order[0]') | xpath3 and regex provide ways of extracting context information that doesn’t already exist as a single value. |
Wildcards | wildcard("Hello*") | Matches a value (the message palyoad, by default) against a wildcard pattern, these use the metacharacters '?' to represent any single character and '*' for a repetition of any character. It’s case sensitive by default. |
Expression | Description |
---|---|
#[2 + 2] | This expression evaluates to 4. |
#[2 + 2 == 4] | This expression uses an operator to perform a comparison. It evaluates to true. |
#[message] | This expression references a context object in MEL (message, app, mule, and server). The value of this expression is the message. |
#[message.id] | This expression accesses the id field of the message context object. The value of this expression is the unique message id that Mule automatically assigns to the message. |
#[payload.firstname] | This expression accesses an object within the field (payload) associated with the context object (message). If the object is a map item whose key is 'firstname' then this expression evaluates to the value associated with the key 'firstname'. If the object is a bean, the property will be returned. |
#[payload[4]] | Same as above, but in this case – provided the field is a list – the expression returns the value of the 5th item in the list. |
#[message.header.get()] | This expression calls the "get" method and performs it on the object, according to the parameter (if any) specified within the parentheses. |
Comments