SlideShare a Scribd company logo
1 of 7
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

What's hot

Std 12 computer chapter 8 classes and object in java (part 2)
Std 12 computer chapter 8 classes and object in java (part 2)Std 12 computer chapter 8 classes and object in java (part 2)
Std 12 computer chapter 8 classes and object in java (part 2)Nuzhat Memon
 
Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...
Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...
Wodel: A DSL for Model Mutation; and Wodel-Edu: its Application to the Automa...Pablo Gómez Abajo
 
Corejava Training in Bangalore Tutorial
Corejava Training in Bangalore TutorialCorejava Training in Bangalore Tutorial
Corejava Training in Bangalore Tutorialrajkamaltibacademy
 
Extracts from "Clean code"
Extracts from "Clean code"Extracts from "Clean code"
Extracts from "Clean code"VlatkaPavii
 

What's hot (13)

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

Similar to Filters in mule

Enumerations in java.pptx
Enumerations in java.pptxEnumerations in java.pptx
Enumerations in java.pptxSrizan Pokrel
 
Configuring Apache Solr for Thai Text Search
Configuring Apache Solr for Thai Text SearchConfiguring Apache Solr for Thai Text Search
Configuring Apache Solr for Thai Text Searchsagarote
 
Elasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfElasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfInexture Solutions
 
Get the most out of Solr search with PHP
Get the most out of Solr search with PHPGet the most out of Solr search with PHP
Get the most out of Solr search with PHPPaul Borgermans
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_scriptVijay Kalyan
 
Javascript classes and scoping
Javascript classes and scopingJavascript classes and scoping
Javascript classes and scopingPatrick Sheridan
 
Learning core java
Learning core javaLearning core java
Learning core javaAbhay Bharti
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variablesteach4uin
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programmingSrinivas Narasegouda
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardHari kiran G
 

Similar to Filters in mule (20)

M expression
M expressionM expression
M expression
 
Enumerations in java.pptx
Enumerations in java.pptxEnumerations in java.pptx
Enumerations in java.pptx
 
Configuring Apache Solr for Thai Text Search
Configuring Apache Solr for Thai Text SearchConfiguring Apache Solr for Thai Text Search
Configuring Apache Solr for Thai Text Search
 
Elasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdfElasticsearch Analyzers Field-Level Optimization.pdf
Elasticsearch Analyzers Field-Level Optimization.pdf
 
Get the most out of Solr search with PHP
Get the most out of Solr search with PHPGet the most out of Solr search with PHP
Get the most out of Solr search with PHP
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
Python with data Sciences
Python with data SciencesPython with data Sciences
Python with data Sciences
 
Typescript
TypescriptTypescript
Typescript
 
Module 1.pptx
Module 1.pptxModule 1.pptx
Module 1.pptx
 
Mule expression
Mule expressionMule expression
Mule expression
 
Mule filters
Mule filtersMule filters
Mule filters
 
Javascript classes and scoping
Javascript classes and scopingJavascript classes and scoping
Javascript classes and scoping
 
Learning core java
Learning core javaLearning core java
Learning core java
 
L2 datatypes and variables
L2 datatypes and variablesL2 datatypes and variables
L2 datatypes and variables
 
Control structures functions and modules in python programming
Control structures functions and modules in python programmingControl structures functions and modules in python programming
Control structures functions and modules in python programming
 
Mule filters
Mule filtersMule filters
Mule filters
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
 
ITFT - Java
ITFT - JavaITFT - Java
ITFT - Java
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
data types.pdf
data types.pdfdata types.pdf
data types.pdf
 

More from Krishna_in

Validations module
Validations moduleValidations module
Validations moduleKrishna_in
 
Mule maven Plugin
Mule maven PluginMule maven Plugin
Mule maven PluginKrishna_in
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control referenceKrishna_in
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow controlKrishna_in
 
Choice flow control reference
Choice flow control referenceChoice flow control reference
Choice flow control referenceKrishna_in
 
Soa(service oriented architecture)
Soa(service oriented architecture)Soa(service oriented architecture)
Soa(service oriented architecture)Krishna_in
 
Soa project fundamentals
Soa project fundamentalsSoa project fundamentals
Soa project fundamentalsKrishna_in
 
Soa methodology
Soa methodologySoa methodology
Soa methodologyKrishna_in
 
Soa governance
Soa governanceSoa governance
Soa governanceKrishna_in
 
Principles of soa
Principles of soaPrinciples of soa
Principles of soaKrishna_in
 
Mule transformers
Mule transformersMule transformers
Mule transformersKrishna_in
 
Mule exception strategies
Mule exception strategiesMule exception strategies
Mule exception strategiesKrishna_in
 
Mule components
Mule componentsMule components
Mule componentsKrishna_in
 
Mule agent architecture
Mule agent architectureMule agent architecture
Mule agent architectureKrishna_in
 
Global elements
Global elementsGlobal elements
Global elementsKrishna_in
 

More from Krishna_in (20)

Validations module
Validations moduleValidations module
Validations module
 
Mule maven Plugin
Mule maven PluginMule maven Plugin
Mule maven Plugin
 
API Policies
API PoliciesAPI Policies
API Policies
 
Data Weave
Data WeaveData Weave
Data Weave
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control reference
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow control
 
Datasense
DatasenseDatasense
Datasense
 
Choice flow control reference
Choice flow control referenceChoice flow control reference
Choice flow control reference
 
Soa(service oriented architecture)
Soa(service oriented architecture)Soa(service oriented architecture)
Soa(service oriented architecture)
 
Soa project fundamentals
Soa project fundamentalsSoa project fundamentals
Soa project fundamentals
 
Soa planning
Soa planningSoa planning
Soa planning
 
Soa methodology
Soa methodologySoa methodology
Soa methodology
 
Soa governance
Soa governanceSoa governance
Soa governance
 
Principles of soa
Principles of soaPrinciples of soa
Principles of soa
 
Mule transformers
Mule transformersMule transformers
Mule transformers
 
Mule exception strategies
Mule exception strategiesMule exception strategies
Mule exception strategies
 
Mule components
Mule componentsMule components
Mule components
 
Mule agent architecture
Mule agent architectureMule agent architecture
Mule agent architecture
 
Message state
Message stateMessage state
Message state
 
Global elements
Global elementsGlobal elements
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)"/>