SlideShare a Scribd company logo
Filters in Mule
Standard Filters
• Mule includes the following standard filters that you can apply to your routers:
• Payload Type Filter
Expression Filter
• Using XPath Expressions
• Using JXPath Expressions
• Using OGNL Expressions
• RegEx Filter
• Wildcard Filter
• Exception Type Filter
• Message Property Filter
Logic Filters
• And Filter
• Or Filter
• Not Filter
Payload Type Filter
• Checks the class type of the payload object
inside a message.
• Example:
<payload-type-filter
expectedType="java.lang.String"/>
Expression Filter
• Evaluates a range of expressions. Use
the evaluator attribute to specify
the expression evaluator to use, one of the
following: header, payload-type, exception-
type, wildcard, regex, ognl, xpath, jxpath,
bean, groovy, or custom. Use
the expression attribute to set the actual
expression. If the expression type
is xpath, bean, or ognl, the expression should
be a boolean
Using XPath Expressions
• XPath expressions are supported using the
standard XPath query language. It is based on
JAXP, the Java API for XML processing. You can
learn more about writing XPath queries from
the XPath tutorial.
Example:
<expression-filter evaluator="xpath"
expression="(msg/header/resultcode)='succes
s'"/>
Using JXPath Expressions
• JXPath is an XPath interpreter that can apply
XPath expressions to graphs of objects of all
kinds: JavaBeans, Maps, Servlet contexts, DOM
etc, including mixtures thereof. For more
information about JXPath, see the JXpath user
guide. For querying XML, it is recommended to
use XPath expressions instead.
• <expression-filter evaluator="jxpath"
expression="(msg/header/resultcode)='success'"
/>
Using OGNL Expressions
• OGNL is a simple yet very powerful expression
language for plain Java objects. Similar to JXPath,
it works on object graphs, and thus the
corresponding filter enables simple and efficient
content routing for payloads. For example:
• <expression-filter evaluator="ognl"
expression="[MULE:0].equals(42)"/>
• or more simply:
• <ognl-filter expression="[MULE:0].equals(42)"/>

More Related Content

PPTX
Java session2
PPTX
Session 08 - Arrays and Methods
ODP
(An Extended) Beginners Guide to Object Orientation in PHP
PPTX
C# Basics
PPTX
Java annotations
PPTX
Java Basics
PPTX
Regular Expressions in Java.
PPTX
Object oriented programming in java
Java session2
Session 08 - Arrays and Methods
(An Extended) Beginners Guide to Object Orientation in PHP
C# Basics
Java annotations
Java Basics
Regular Expressions in Java.
Object oriented programming in java

What's hot (13)

DOCX
Core java by amit
PPTX
Std 12 computer chapter 8 classes and object in java (part 2)
PPTX
PCSTt11 overview of java
PPTX
Mule java part-3
PDF
Lecture 8 Library classes
PDF
Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...
PDF
Generics
PPT
Corejava Training in Bangalore Tutorial
PDF
Extracts from "Clean code"
PPTX
Java basics
PPTX
Suga java training_with_footer
PPTX
Overview of Java
PPT
Chap02
Core java by amit
Std 12 computer chapter 8 classes and object in java (part 2)
PCSTt11 overview of java
Mule java part-3
Lecture 8 Library classes
Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...
Generics
Corejava Training in Bangalore Tutorial
Extracts from "Clean code"
Java basics
Suga java training_with_footer
Overview of Java
Chap02
Ad

Similar to Filters in mule (20)

PPTX
M expression
PPTX
Enumerations in java.pptx
PDF
Configuring Apache Solr for Thai Text Search
PDF
Elasticsearch Analyzers Field-Level Optimization.pdf
PDF
Get the most out of Solr search with PHP
PPTX
Generics Module 2Generics Module Generics Module 2.pptx
PDF
8 introduction to_java_script
PPTX
Python with data Sciences
PPTX
Typescript
PPTX
Module 1.pptx
PDF
JAVA Class Presentation.pdf Vsjsjsnheheh
PPTX
Mule expression
PPTX
Mule filters
PPT
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
PDF
Javascript classes and scoping
PPTX
Learning core java
PPTX
L2 datatypes and variables
PDF
Control structures functions and modules in python programming
PPTX
Mule filters
PPTX
OCP Java (OCPJP) 8 Exam Quick Reference Card
M expression
Enumerations in java.pptx
Configuring Apache Solr for Thai Text Search
Elasticsearch Analyzers Field-Level Optimization.pdf
Get the most out of Solr search with PHP
Generics Module 2Generics Module Generics Module 2.pptx
8 introduction to_java_script
Python with data Sciences
Typescript
Module 1.pptx
JAVA Class Presentation.pdf Vsjsjsnheheh
Mule expression
Mule filters
123 JAVA CLASSES, OBJECTS AND METHODS.ppt
Javascript classes and scoping
Learning core java
L2 datatypes and variables
Control structures functions and modules in python programming
Mule filters
OCP Java (OCPJP) 8 Exam Quick Reference Card
Ad

More from Krishna_in (20)

PDF
Validations module
PDF
Mule maven Plugin
PDF
API Policies
PDF
Data Weave
PPTX
Splitter flow control reference
PPTX
Scatter gather flow control
PPTX
Datasense
PPTX
Choice flow control reference
PPTX
Soa(service oriented architecture)
PPTX
Soa project fundamentals
PPTX
Soa planning
PPTX
Soa methodology
PPTX
Soa governance
PPTX
Principles of soa
PPTX
Mule transformers
PPTX
Mule exception strategies
PPTX
Mule components
PPTX
Mule agent architecture
PPTX
Message state
PPTX
Global elements
Validations module
Mule maven Plugin
API Policies
Data Weave
Splitter flow control reference
Scatter gather flow control
Datasense
Choice flow control reference
Soa(service oriented architecture)
Soa project fundamentals
Soa planning
Soa methodology
Soa governance
Principles of soa
Mule transformers
Mule exception strategies
Mule components
Mule agent architecture
Message state
Global elements

Filters in mule

  • 2. Standard Filters • Mule includes the following standard filters that you can apply to your routers: • Payload Type Filter Expression Filter • Using XPath Expressions • Using JXPath Expressions • Using OGNL Expressions • RegEx Filter • Wildcard Filter • Exception Type Filter • Message Property Filter Logic Filters • And Filter • Or Filter • Not Filter
  • 3. Payload Type Filter • Checks the class type of the payload object inside a message. • Example: <payload-type-filter expectedType="java.lang.String"/>
  • 4. Expression Filter • Evaluates a range of expressions. Use the evaluator attribute to specify the expression evaluator to use, one of the following: header, payload-type, exception- type, wildcard, regex, ognl, xpath, jxpath, bean, groovy, or custom. Use the expression attribute to set the actual expression. If the expression type is xpath, bean, or ognl, the expression should be a boolean
  • 5. Using XPath Expressions • XPath expressions are supported using the standard XPath query language. It is based on JAXP, the Java API for XML processing. You can learn more about writing XPath queries from the XPath tutorial. Example: <expression-filter evaluator="xpath" expression="(msg/header/resultcode)='succes s'"/>
  • 6. Using JXPath Expressions • JXPath is an XPath interpreter that can apply XPath expressions to graphs of objects of all kinds: JavaBeans, Maps, Servlet contexts, DOM etc, including mixtures thereof. For more information about JXPath, see the JXpath user guide. For querying XML, it is recommended to use XPath expressions instead. • <expression-filter evaluator="jxpath" expression="(msg/header/resultcode)='success'" />
  • 7. Using OGNL Expressions • OGNL is a simple yet very powerful expression language for plain Java objects. Similar to JXPath, it works on object graphs, and thus the corresponding filter enables simple and efficient content routing for payloads. For example: • <expression-filter evaluator="ognl" expression="[MULE:0].equals(42)"/> • or more simply: • <ognl-filter expression="[MULE:0].equals(42)"/>