SlideShare a Scribd company logo
Mule Expression Language
Mule Expression Language(MEL) - Introduction
 Mule Expression Language (MEL) supports the work of message processors by
providing a means of accessing, manipulating, and using information from the
message and its environment.
 In most cases, Mule expressions work within message processors to modify the way
those processors do their main jobs (for example, routing, filtering). Following are
the principal use cases:
 Make a decision based on the contents, properties, or context of a message and its
attachments. For example, a flow controller can route purchase orders for different types
of products to different JMS queues.
 Select a value from the contents, properties, or context of a message and its attachments.
For example, a cloud connector might extract a specific piece of information from the
current message to use as an argument.
 Replace a token with an actual value. For example, a logger can extract information from
the payload contents and place it into a logging message.
 We can also use MEL to implement a program (script) for which we would
otherwise use a programming language like Ruby, JavaScript, or Groovy. Scripts in
those languages cannot access the message and its environment as conveniently as
MEL can. In this case, MEL is the programming language for a custom message
processor.
Mule Expression Language - Syntax
Mule Expression Language Syntax
 MEL expression combines one or more operands with zero or more operators in a Java-like
syntax and returns the resulting value.
 Java method invocations and assignments are the other common MEL expressions.
 In most cases, a MEL expression stands alone as the value of a configuration property of a
message processor. Mule evaluates the expression at runtime, and the message processor
uses the result.
 MEL operators and basic operands are conventional and predictable (for example, 2 + 2 == 4
returns true). Property expressions provide convenient access to information from the
message and its environment (for example, server.fileSeparator returns "/" if the application is
running on a Linux server, and "" on a Windows server.). The remainder of this section
summarizes the most important elements of MEL syntax.
Mule Expression Language – Operand, Property
MEL Operand
 An operand can be a literal, a variable, or a MEL expression.
 The MEL expressions that most commonly appear as operands are property expressions and
method invocations.
Property Expressions
 The syntax of a property expression is “contextObject.property”. This can appear as an
operand in most MEL expressions, including on the left side of an assignment if the property is
writable from MEL.
Method Invocations
 Mule Expression Language uses standard Java method invocation.
 We can provide a fully qualified class name or import a class and use the unqualified name.
MEL automatically imports a number of Java classes.
 Eg. message.payload.getName(). If payload is a Java object—for example, representing a
person—this code invokes its getName method. The value of the expression is the value that
getName returns—presumably a string representing the person’s name.
MEL Operators
 MEL operators follow standard Java syntax, but operands are always by value, not by
reference. For example, "A" == 'A' evaluates to true, whereas the same expression evaluates
to false in Java.
Arithmetic Operators
Mule Expression Language – Arithmetic Operators
Symbol Definition Example/Value
-
Minus. The value is the value of the first operand minus the
value of the second.
2 - 4
-2
%
Modulo. The value is the remainder after dividing the value
of the first operand by the value of the second.
9 % 4
1
/
Over. The value is the value of the first operand divided by
the value of the second.
2 / 4
0.5
+
Plus. For numbers, the value is the sum of the values of the
operands. For strings, the value is the string formed by
concatenating the values of the operands.
2 + 4
6
'fu' + 'bar'
The String "fubar"
*
Times. The value is the product of the values of the
operands.
2 * 4
8
Comparison Operators
Mule Expression Language – Comparison Operators
Symbol Definition Example/Value
==
Equal. True if and only if (iff) the values of the operands are
equal.
'A' == 'A'
true
!= Not equal. True iff the values of the operands are unequal.
'A' != 'B'
true
>
Greater than. True iff the value on the left is greater than the
value on the right.
7 > 5
true
<
Less than. True iff the value on the left is less than the value
on the right
5 < 5
false
>=
Greater than or equal. True iff the value on the left is greater
than or equal to the value on the right.
5 >= 7
false
<=
Less than or equal. True iff the value on the left is less than or
equal to the value on the right.
5 <= 5
true
contains
Contains. True iff the string on the right is a substring of the
string on the left.
'fubar' contains
'bar'
true
is,
instance
of
Is an instance of. True iff the object on the left is an instance
of the class on the right.
'fubar' is String
true
Comparison Operators - contd
Logical Operators
Mule Expression Language – Logical Operators
Symbol Definition Example/Value
strsim
Degree of similarity. The value of the expression is a
number between 0 and 1 representing the degree of
similarity between the two string arguments.
'foo' strsim 'foo'
1.0
‘foobar’ strsim ‘foo’
0.5
soundslike
Sounds like. True iff the two string arguments sound alike
according to a Soundex comparison.
'Robert' soundslike
'Rupert'
true
Symbol Definition Example/Value
and
Logical AND. True iff both operands are true. (Don’t use
&&)
(a == b) and (c != d)
true iff a =b and c ≠ d
|| Logical OR. True iff at least one operand is true.
true ||anything
Always true
or
Chained OR. Scans left to right and returns the value of
the first non-empty item
false or '' or ' ' or 'dog'
The String "dog"
Mule Expression Language – Assignment, Literals
MEL Assignment
 An assignment is a MEL expression consisting of an identifier representing a mutable object to
the left of an equal sign and a MEL expression to the right of the equal sign. Eg:
message.payload = 'fu‘ sets the payload of the current message to the string "fu".
 MEL determines types dynamically, so declaring the type of a variable is optional. For example
if, with no prior declarations, if we write number = 1; number == '1' MEL assigns the
expression the value true.
 We can cast values to specific types. For example if we write
number = (String)1; number is String
MEL returns the value true for this expression.
MEL Literals
 Literals in MEL can be strings, numbers, Boolean values, types, and nulls. Maps, Lists and
Arrays data structures as literals as well.
MEL Literals – Numeric Literals
 Numeric literals are integers and floating point numbers, with the same ranges of values as
the underlying Java system.
MEL Literals – String Literals
 String literals are sequences of characters enclosed in single quotes. We cannot use double
quotes to express String literals as we can in Java, because MEL expressions appear within
double quotes in configuration files.
Mule Expression Language – Maps, Lists and Arrays
MEL Key/Value Maps, Lists, and Arrays
 Mule Expression Language uses a convenient syntax for maps and other data structures. It
begins with map literals, and there is also a convenient way to access items in maps. MEL
provides a streamlined way to access map data. Rather than constructing a map with a new
statement, and then using its put method to populate it, we can simply write the following:
[key1 : value1, key2 : value2, . . .]
and use this literal form wherever we would otherwise use a map by name, including as a
method argument.
 similar literal forms for lists ([item1, item2, . . .]) and arrays ({item1, item2, . . .}).
 Arrays in Java must specify the type of their contents, but in MEL they are untyped. MEL
supplies the correct type when we use them – either by determining it at compile time or
coercing the array to the correct type at run time.
Mule Expression Language–Control Flow, Context Objects
Control Flow
 MEL provides a full range of Java control flow statements. The most useful for typical MEL
expressions are conditional operands (often called ternary statements).
 A conditional operand has the form condition ? true value : false value.
For example, x = (name == 'Smith' ? 'Smith' : 'Unknown') sets the variable x to the string
"Smith" if the value of name is "Smith" and to the string "Unknown" if the value of name
is not "Smith".
MEL Context Objects
 Context objects model the message and its environment. They make MEL Mule-centric, not
just another expression language. Different context objects are
 Server: properties of the hardware, operating system, user, and network interface.
 Mule: properties of the Mule instance.
 App: properties of the Mule application.
 Message: properties of the Mule message - [DEFAULT]
Mule Expression Language – Context Object – Message
Message
 This object provides access to the properties of the Mule message listed in the table.
Name Description
id (read-only)
rootId (read-only)
correlationId (read-only)
correlationSequence (read-only)
correlationGroupSize (read-only)
replyTo (read/write)
dataType (read-only)
payload (read/write)
inboundProperties Map (read-only)
inboundAttachments Map (read-only)
outboundProperties Map (read/write)
outboundAttachments Map (read/write)
exception (read-only)
Mule Expression Language – Variables
Variables
In addition to local MEL variables, whose scope is the current message
processor, MEL gives you access to Mule flow and session variables. The
variables reside in the following maps, which are available to use in MEL
expressions:
 flowVars – contains variables that are global to the current flow. They retain their values
as control passes from one message processor to another. Thus, you can set them in one
message processor and use them in another.
 SessionVars – is essentially the same as flowVars, except that when one flow calls another
one via a Mule endpoint they are propagated.
For example, to access the value of the foo flow variable, write
flowVars['foo']. This can appear on either side of an assignment. For
example, the following code gets the value of the session variable bar and
uses it to set the value of the flow variable bar.
flowVars['foo'] = sessionVars['bar']
Mule Expression Language – Data Extraction Function
Data Extraction Function
 The functions xpath and regex provide ways of extracting context information extract
information that doesn’t already exist as a single value that can be embodied in a property. By
default they work on the payload, but we can pass them different arguments explicitly.
Thank you

More Related Content

Viewers also liked

Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
Mani Rathnam Gudi
 
Mule expression language
Mule expression languageMule expression language
Mule expression language
sathyaraj Anand
 
Timer Interceptor in Mule
Timer Interceptor in MuleTimer Interceptor in Mule
Timer Interceptor in Mule
Anirban Sen Chowdhary
 
Mulesoft ppt
Mulesoft pptMulesoft ppt
Mulesoft ppt
Achyuta Lakshmi
 
Creating global functions
Creating global functionsCreating global functions
Creating global functions
Rahul Kumar
 
Cymi Ecourja
Cymi EcourjaCymi Ecourja
Cymi Ecourja
HIMADRI BANERJI
 
Using elasticsearch with rails
Using elasticsearch with railsUsing elasticsearch with rails
Using elasticsearch with railsTom Z Zeng
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
Gandham38
 
Mule connectors
Mule  connectorsMule  connectors
Mule connectors
himajareddys
 
Mule deploying a cloud hub application
Mule deploying a cloud hub applicationMule deploying a cloud hub application
Mule deploying a cloud hub application
D.Rajesh Kumar
 
Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
AbdulImrankhan7
 
Generating Documentation for Mule ESB Application
Generating Documentation for Mule ESB ApplicationGenerating Documentation for Mule ESB Application
Generating Documentation for Mule ESB Application
Rupesh Sinha
 
Mule esb How to convert from CSV to Json in 5 minutes
Mule esb How to convert from CSV to Json in 5 minutesMule esb How to convert from CSV to Json in 5 minutes
Mule esb How to convert from CSV to Json in 5 minutes
Gennaro Spagnoli
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
akashdprajapati
 
Demo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook ConnectorDemo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook Connector
Rupesh Sinha
 
Carabook 2010
Carabook 2010Carabook 2010
Carabook 2010
hajoura1971
 
Poly dcem2-nephro
Poly   dcem2-nephroPoly   dcem2-nephro
Poly dcem2-nephro
hajoura1971
 
CV of Md. Golam Robbani_ RUET -IPE
CV of Md. Golam Robbani_ RUET -IPECV of Md. Golam Robbani_ RUET -IPE
CV of Md. Golam Robbani_ RUET -IPEGolam Robbani
 
Enc qr gynéco obst
Enc qr   gynéco obstEnc qr   gynéco obst
Enc qr gynéco obst
hajoura1971
 

Viewers also liked (20)

Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
 
Mule expression language
Mule expression languageMule expression language
Mule expression language
 
Timer Interceptor in Mule
Timer Interceptor in MuleTimer Interceptor in Mule
Timer Interceptor in Mule
 
Mulesoft ppt
Mulesoft pptMulesoft ppt
Mulesoft ppt
 
Creating global functions
Creating global functionsCreating global functions
Creating global functions
 
Cymi Ecourja
Cymi EcourjaCymi Ecourja
Cymi Ecourja
 
Using elasticsearch with rails
Using elasticsearch with railsUsing elasticsearch with rails
Using elasticsearch with rails
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
 
Mule connectors
Mule  connectorsMule  connectors
Mule connectors
 
Mule deploying a cloud hub application
Mule deploying a cloud hub applicationMule deploying a cloud hub application
Mule deploying a cloud hub application
 
Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
 
Generating Documentation for Mule ESB Application
Generating Documentation for Mule ESB ApplicationGenerating Documentation for Mule ESB Application
Generating Documentation for Mule ESB Application
 
Mule esb How to convert from CSV to Json in 5 minutes
Mule esb How to convert from CSV to Json in 5 minutesMule esb How to convert from CSV to Json in 5 minutes
Mule esb How to convert from CSV to Json in 5 minutes
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
 
Demo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook ConnectorDemo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook Connector
 
Carabook 2010
Carabook 2010Carabook 2010
Carabook 2010
 
Poly dcem2-nephro
Poly   dcem2-nephroPoly   dcem2-nephro
Poly dcem2-nephro
 
CV of Md. Golam Robbani_ RUET -IPE
CV of Md. Golam Robbani_ RUET -IPECV of Md. Golam Robbani_ RUET -IPE
CV of Md. Golam Robbani_ RUET -IPE
 
Enc qr gynéco obst
Enc qr   gynéco obstEnc qr   gynéco obst
Enc qr gynéco obst
 
TermPaper
TermPaperTermPaper
TermPaper
 

Similar to Mule Expression language

Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
Son Nguyen
 
Expression language
Expression languageExpression language
Expression language
Son Nguyen
 
Mule expression language - Part 1
Mule expression language - Part 1Mule expression language - Part 1
Mule expression language - Part 1
Karthik Selvaraj
 
Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...
Julian Hyde
 
Lecture 09.pptx
Lecture 09.pptxLecture 09.pptx
Lecture 09.pptx
Mohammad Hassan
 
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
Alkis Vazacopoulos
 
What is the deal with Elixir?
What is the deal with Elixir?What is the deal with Elixir?
What is the deal with Elixir?
George Coffey
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
Raymond Tay
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameAntony Stubbs
 
Erlang kickstart
Erlang kickstartErlang kickstart
Erlang kickstart
Ryan Brown
 
Session 05 – mel and expression
Session 05 – mel and expressionSession 05 – mel and expression
Session 05 – mel and expression
Trí Bằng
 
Introduction to Python Values, Variables Data Types Chapter 2
Introduction to Python  Values, Variables Data Types Chapter 2Introduction to Python  Values, Variables Data Types Chapter 2
Introduction to Python Values, Variables Data Types Chapter 2
Raza Ul Mustafa
 
Mule mel 1
Mule mel 1Mule mel 1
Mule mel 1
kunal vishe
 
A short introduction on mule expression language
A short introduction on mule expression languageA short introduction on mule expression language
A short introduction on mule expression language
Swapnil Sahu
 
Relational Model
Relational ModelRelational Model
Relational Model
A. S. M. Shafi
 
3.pdf
3.pdf3.pdf
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
java_lect_03-2.ppt
java_lect_03-2.pptjava_lect_03-2.ppt
java_lect_03-2.ppt
kavitamittal18
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagram
dddgh
 

Similar to Mule Expression language (20)

Expression language in mule
Expression language in muleExpression language in mule
Expression language in mule
 
Expression language
Expression languageExpression language
Expression language
 
Mule expression language - Part 1
Mule expression language - Part 1Mule expression language - Part 1
Mule expression language - Part 1
 
Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...Is there a perfect data-parallel programming language? (Experiments with More...
Is there a perfect data-parallel programming language? (Experiments with More...
 
Lecture 09.pptx
Lecture 09.pptxLecture 09.pptx
Lecture 09.pptx
 
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
Server-Solvers-Interacter-Interfacer-Modeler-Presolver Libraries and Executab...
 
What is the deal with Elixir?
What is the deal with Elixir?What is the deal with Elixir?
What is the deal with Elixir?
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
Scala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love GameScala Language Intro - Inspired by the Love Game
Scala Language Intro - Inspired by the Love Game
 
Erlang kickstart
Erlang kickstartErlang kickstart
Erlang kickstart
 
Session 05 – mel and expression
Session 05 – mel and expressionSession 05 – mel and expression
Session 05 – mel and expression
 
Introduction to Python Values, Variables Data Types Chapter 2
Introduction to Python  Values, Variables Data Types Chapter 2Introduction to Python  Values, Variables Data Types Chapter 2
Introduction to Python Values, Variables Data Types Chapter 2
 
Mule mel 1
Mule mel 1Mule mel 1
Mule mel 1
 
A short introduction on mule expression language
A short introduction on mule expression languageA short introduction on mule expression language
A short introduction on mule expression language
 
Perl_Part4
Perl_Part4Perl_Part4
Perl_Part4
 
Relational Model
Relational ModelRelational Model
Relational Model
 
3.pdf
3.pdf3.pdf
3.pdf
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
java_lect_03-2.ppt
java_lect_03-2.pptjava_lect_03-2.ppt
java_lect_03-2.ppt
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagram
 

Recently uploaded

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 

Recently uploaded (20)

June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 

Mule Expression language

  • 2. Mule Expression Language(MEL) - Introduction  Mule Expression Language (MEL) supports the work of message processors by providing a means of accessing, manipulating, and using information from the message and its environment.  In most cases, Mule expressions work within message processors to modify the way those processors do their main jobs (for example, routing, filtering). Following are the principal use cases:  Make a decision based on the contents, properties, or context of a message and its attachments. For example, a flow controller can route purchase orders for different types of products to different JMS queues.  Select a value from the contents, properties, or context of a message and its attachments. For example, a cloud connector might extract a specific piece of information from the current message to use as an argument.  Replace a token with an actual value. For example, a logger can extract information from the payload contents and place it into a logging message.  We can also use MEL to implement a program (script) for which we would otherwise use a programming language like Ruby, JavaScript, or Groovy. Scripts in those languages cannot access the message and its environment as conveniently as MEL can. In this case, MEL is the programming language for a custom message processor.
  • 3. Mule Expression Language - Syntax Mule Expression Language Syntax  MEL expression combines one or more operands with zero or more operators in a Java-like syntax and returns the resulting value.  Java method invocations and assignments are the other common MEL expressions.  In most cases, a MEL expression stands alone as the value of a configuration property of a message processor. Mule evaluates the expression at runtime, and the message processor uses the result.  MEL operators and basic operands are conventional and predictable (for example, 2 + 2 == 4 returns true). Property expressions provide convenient access to information from the message and its environment (for example, server.fileSeparator returns "/" if the application is running on a Linux server, and "" on a Windows server.). The remainder of this section summarizes the most important elements of MEL syntax.
  • 4. Mule Expression Language – Operand, Property MEL Operand  An operand can be a literal, a variable, or a MEL expression.  The MEL expressions that most commonly appear as operands are property expressions and method invocations. Property Expressions  The syntax of a property expression is “contextObject.property”. This can appear as an operand in most MEL expressions, including on the left side of an assignment if the property is writable from MEL. Method Invocations  Mule Expression Language uses standard Java method invocation.  We can provide a fully qualified class name or import a class and use the unqualified name. MEL automatically imports a number of Java classes.  Eg. message.payload.getName(). If payload is a Java object—for example, representing a person—this code invokes its getName method. The value of the expression is the value that getName returns—presumably a string representing the person’s name. MEL Operators  MEL operators follow standard Java syntax, but operands are always by value, not by reference. For example, "A" == 'A' evaluates to true, whereas the same expression evaluates to false in Java.
  • 5. Arithmetic Operators Mule Expression Language – Arithmetic Operators Symbol Definition Example/Value - Minus. The value is the value of the first operand minus the value of the second. 2 - 4 -2 % Modulo. The value is the remainder after dividing the value of the first operand by the value of the second. 9 % 4 1 / Over. The value is the value of the first operand divided by the value of the second. 2 / 4 0.5 + Plus. For numbers, the value is the sum of the values of the operands. For strings, the value is the string formed by concatenating the values of the operands. 2 + 4 6 'fu' + 'bar' The String "fubar" * Times. The value is the product of the values of the operands. 2 * 4 8
  • 6. Comparison Operators Mule Expression Language – Comparison Operators Symbol Definition Example/Value == Equal. True if and only if (iff) the values of the operands are equal. 'A' == 'A' true != Not equal. True iff the values of the operands are unequal. 'A' != 'B' true > Greater than. True iff the value on the left is greater than the value on the right. 7 > 5 true < Less than. True iff the value on the left is less than the value on the right 5 < 5 false >= Greater than or equal. True iff the value on the left is greater than or equal to the value on the right. 5 >= 7 false <= Less than or equal. True iff the value on the left is less than or equal to the value on the right. 5 <= 5 true contains Contains. True iff the string on the right is a substring of the string on the left. 'fubar' contains 'bar' true is, instance of Is an instance of. True iff the object on the left is an instance of the class on the right. 'fubar' is String true
  • 7. Comparison Operators - contd Logical Operators Mule Expression Language – Logical Operators Symbol Definition Example/Value strsim Degree of similarity. The value of the expression is a number between 0 and 1 representing the degree of similarity between the two string arguments. 'foo' strsim 'foo' 1.0 ‘foobar’ strsim ‘foo’ 0.5 soundslike Sounds like. True iff the two string arguments sound alike according to a Soundex comparison. 'Robert' soundslike 'Rupert' true Symbol Definition Example/Value and Logical AND. True iff both operands are true. (Don’t use &&) (a == b) and (c != d) true iff a =b and c ≠ d || Logical OR. True iff at least one operand is true. true ||anything Always true or Chained OR. Scans left to right and returns the value of the first non-empty item false or '' or ' ' or 'dog' The String "dog"
  • 8. Mule Expression Language – Assignment, Literals MEL Assignment  An assignment is a MEL expression consisting of an identifier representing a mutable object to the left of an equal sign and a MEL expression to the right of the equal sign. Eg: message.payload = 'fu‘ sets the payload of the current message to the string "fu".  MEL determines types dynamically, so declaring the type of a variable is optional. For example if, with no prior declarations, if we write number = 1; number == '1' MEL assigns the expression the value true.  We can cast values to specific types. For example if we write number = (String)1; number is String MEL returns the value true for this expression. MEL Literals  Literals in MEL can be strings, numbers, Boolean values, types, and nulls. Maps, Lists and Arrays data structures as literals as well. MEL Literals – Numeric Literals  Numeric literals are integers and floating point numbers, with the same ranges of values as the underlying Java system. MEL Literals – String Literals  String literals are sequences of characters enclosed in single quotes. We cannot use double quotes to express String literals as we can in Java, because MEL expressions appear within double quotes in configuration files.
  • 9. Mule Expression Language – Maps, Lists and Arrays MEL Key/Value Maps, Lists, and Arrays  Mule Expression Language uses a convenient syntax for maps and other data structures. It begins with map literals, and there is also a convenient way to access items in maps. MEL provides a streamlined way to access map data. Rather than constructing a map with a new statement, and then using its put method to populate it, we can simply write the following: [key1 : value1, key2 : value2, . . .] and use this literal form wherever we would otherwise use a map by name, including as a method argument.  similar literal forms for lists ([item1, item2, . . .]) and arrays ({item1, item2, . . .}).  Arrays in Java must specify the type of their contents, but in MEL they are untyped. MEL supplies the correct type when we use them – either by determining it at compile time or coercing the array to the correct type at run time.
  • 10. Mule Expression Language–Control Flow, Context Objects Control Flow  MEL provides a full range of Java control flow statements. The most useful for typical MEL expressions are conditional operands (often called ternary statements).  A conditional operand has the form condition ? true value : false value. For example, x = (name == 'Smith' ? 'Smith' : 'Unknown') sets the variable x to the string "Smith" if the value of name is "Smith" and to the string "Unknown" if the value of name is not "Smith". MEL Context Objects  Context objects model the message and its environment. They make MEL Mule-centric, not just another expression language. Different context objects are  Server: properties of the hardware, operating system, user, and network interface.  Mule: properties of the Mule instance.  App: properties of the Mule application.  Message: properties of the Mule message - [DEFAULT]
  • 11. Mule Expression Language – Context Object – Message Message  This object provides access to the properties of the Mule message listed in the table. Name Description id (read-only) rootId (read-only) correlationId (read-only) correlationSequence (read-only) correlationGroupSize (read-only) replyTo (read/write) dataType (read-only) payload (read/write) inboundProperties Map (read-only) inboundAttachments Map (read-only) outboundProperties Map (read/write) outboundAttachments Map (read/write) exception (read-only)
  • 12. Mule Expression Language – Variables Variables In addition to local MEL variables, whose scope is the current message processor, MEL gives you access to Mule flow and session variables. The variables reside in the following maps, which are available to use in MEL expressions:  flowVars – contains variables that are global to the current flow. They retain their values as control passes from one message processor to another. Thus, you can set them in one message processor and use them in another.  SessionVars – is essentially the same as flowVars, except that when one flow calls another one via a Mule endpoint they are propagated. For example, to access the value of the foo flow variable, write flowVars['foo']. This can appear on either side of an assignment. For example, the following code gets the value of the session variable bar and uses it to set the value of the flow variable bar. flowVars['foo'] = sessionVars['bar']
  • 13. Mule Expression Language – Data Extraction Function Data Extraction Function  The functions xpath and regex provide ways of extracting context information extract information that doesn’t already exist as a single value that can be embodied in a property. By default they work on the payload, but we can pass them different arguments explicitly.