This presentation provides you an introduction to Mule Expression Language. You can watch the demo through the following link : https://youtu.be/fAj98tFqv_M
2. Introduction
Mule Expression Language (MEL) was introduced in
Mule 3.3.0
Prior to version 3.3.0, expressions in Mule varied in
syntax according to their specific evaluator.
The variation in syntax rules was time-consuming to
learn and hence MEL was created to address this
complexity.
Mule Expression Language (MEL), implements a
single set of syntax rules.
3. Expression VS Scripting language
An expression language, such as MEL, is similar, but
not the same as, a scripting language. It allows you to
write short scripts that resolve dynamically to get
values, set values, or perform an operation on data.
Scripting languages are generally more useful if you
are writing something complex enough to require
more than just a few lines of code, or if you need to
include conditional logic.
If you need to get or set values, invoke methods, or
perform functions, you can do so quickly and easily
using an expression language.
4. MEL Assigning Values
Point the cursor to value field and press CTRL + Space
key to get the list of values to assign
5. MEL Context Objects
Context Objects
server: this object provides access to the fields for the
hardware, operating system, user, and network
interface.
mule: this object provides access to the fields for your
Mule instance.
app: this object provides access to the fields of your
Mule application.
message: this object provides access to the fields of the
Mule message.
7. MEL Variable
You can use the variable name directly in a MEL
expression
#[firstname] is equivalent to #[flowVars.firstname]
#[lastname] is equivalent to #[sessionVars.lastname]
Mule assumes that it is a flowVars and, when MEL
evaluates the expression, looks for a variable by that
name. If Mule cannot find a flowVars by that name, it
looks for a sessionVars by that name before failing.
8. MEL Variable
If you wish to disable this auto-resolution of variables
by name, please include the below flow configuration
xml
<configuration> <expression-language
autoResolveVariables="false"/> </configuration>