SlideShare uma empresa Scribd logo
1 de 7
*
*One common scenario involves the need to enrich an
incoming message with information that isn’t provided by
the source system
*Mule currently supports enrichment of flow variables and
message headers only.
*The “enrichment resource” can be any message
processor, outbound connector, processor-chain or
flow-ref.
*By having inline enrich tags for multiple targets
* <?xml version="1.0" encoding="UTF-8"?>
* <mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
* xmlns:spring="http://www.springframework.org/schema/beans"
* xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
* xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-curre
* http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
* http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
* http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
* http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
* http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd
* http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
* <http:listener-config name="HTTP_Listener_8124" host="localhost" port="8124" doc:name="HTTP Listener Configuration"/>
* <data-mapper:config name="XML_To_XML" transformationGraphPath="xml_to_xml.grf" doc:name="XML_To_XML"/>
* <http:request-config name="HTTP_Request_Configuration" host="localhost" port="8124" doc:name="HTTP Request Configuration"/>
* <flow name="encricherFlow">
* <http:listener config-ref="HTTP_Listener_8124" path="/enricher" doc:name="HTTP"/>
* <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
* <enricher doc:name="Message Enricher">
* <flow-ref name="assign_state_using_zip" doc:name="get state variable"/>
* <enrich target="#[sessionvariable:newState]" source="#[xpath://enrichedPayload/state]"/>
* <!-- <enrich target="#[variable:newState]" source="#[xpath://enrichedPayload/state]"/> -->
* <enrich target="#[variable:country]" source="#[xpath://enrichedPayload/country']"/>
* </enricher>
*
* <logger doc:name="Logger"/>
* <data-mapper:transform config-ref="XML_To_XML" doc:name="XML To XML">
* <data-mapper:input-arguments>
* <data-mapper:input-argument key="CountryCode">#[flowVars.country]</data-mapper:input-argument>
* <data-mapper:input-argument key="State">#[sessionVars.newState]</data-mapper:input-argument>
* </data-mapper:input-arguments>
* </data-mapper:transform>
* </flow>
* <sub-flow name="assign_state_using_zip">
* <expression-component doc:name="Andhra"><![CDATA[String response="<enrichedPayload>";
* if( xpath3("//address/zip").equals("518001")){
* response += "<state>AP</state>";
* }
* else if(xpath3("//address/zip").equals("500001")){
* response += "<state>TS</state>";
* }
* else{
* response += "<state>INVALID STATE</state>";
* }
* if( xpath3("//address/country").equalsIgnoreCase("INDIA")){
* response += "<country>+91</country>";
* }
* else if(xpath3("//address/country").equalsIgnoreCase("UK")){
* response += "<state>+44</state>";
* }
* else{
* response += "<state>INVALID Country</state>";
* }
* response += "</enrichedPayload>";
*
* payload = response;
* System.out.println("Enriched Payload is::"+payload);]]></expression-component>
* </sub-flow>
* <flow name="complexencricherFlow">
* <http:listener config-ref="HTTP_Listener_8124" path="/complexenricher" doc:name="HTTP"/>
* <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
* <enricher doc:name="Message Enricher" target="#[flowVars.state]" source="#[xpath2://address/state]">
* <processor-chain doc:name="Processor Chain">
* <http:request config-ref="HTTP_Request_Configuration" path="/state" method="POST" doc:name="HTTP"/>
* <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
* </processor-chain>
* </enricher>
* <data-mapper:transform config-ref="XML_To_XML" doc:name="XML To XML">
* <data-mapper:input-arguments>
* <data-mapper:input-argument key="State">#[flowVars.state]</data-mapper:input-argument>
* </data-mapper:input-arguments>
* </data-mapper:transform>
* </flow>
*
* <flow name="muleencricherFlow">
* <http:listener config-ref="HTTP_Listener_8124" path="/state" doc:name="HTTP"/>
* <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
* <expression-transformer doc:name="Expression">
* <return-argument evaluator="xpath2" expression="/address/zip"/>
* </expression-transformer>
* <choice doc:name="evaluate zip and assingn a state">
* <when expression="#[payload =='518001']">
* <set-payload value="&lt;address&gt;&lt;state&gt;AP&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/>
* </when>
* <when expression="#[payload =='500043']">
* <set-payload value="&lt;address&gt;&lt;state&gt;TS&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/>
* </when>
* <otherwise>
* <set-payload value="&lt;address&gt;&lt;state&gt;Andhra&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/>
* </otherwise>
* </choice>
* </flow>
* </mule>
*
*Thank You

Mais conteúdo relacionado

Mais procurados

Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule Rajkattamuri
 
Mule security - spring security manager
Mule  security - spring security managerMule  security - spring security manager
Mule security - spring security managerD.Rajesh Kumar
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routerssathyaraj Anand
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in muleKhan625
 
MuleSoft ESB Routes first-successful
MuleSoft ESB Routes first-successfulMuleSoft ESB Routes first-successful
MuleSoft ESB Routes first-successfulakashdprajapati
 
Basic example using for each component
Basic example using for each componentBasic example using for each component
Basic example using for each componentprudhvivreddy
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input dataAnilKumar Etagowni
 
Mule Esb Data Weave
Mule Esb Data WeaveMule Esb Data Weave
Mule Esb Data WeaveMohammed246
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connectorGermano Barba
 
Filter expression in mule demo
Filter expression in mule demoFilter expression in mule demo
Filter expression in mule demoSudha Ch
 
Cake PHP 3 Presentaion
Cake PHP 3 PresentaionCake PHP 3 Presentaion
Cake PHP 3 Presentaionglslarmenta
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64akashdprajapati
 
For each component in mule
For each component in muleFor each component in mule
For each component in muleRajkattamuri
 

Mais procurados (16)

Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
 
Mule security - spring security manager
Mule  security - spring security managerMule  security - spring security manager
Mule security - spring security manager
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
 
MuleSoft ESB Routes first-successful
MuleSoft ESB Routes first-successfulMuleSoft ESB Routes first-successful
MuleSoft ESB Routes first-successful
 
Basic example using for each component
Basic example using for each componentBasic example using for each component
Basic example using for each component
 
Mule esb data weave multi input data
Mule esb data weave multi input dataMule esb data weave multi input data
Mule esb data weave multi input data
 
Mule Esb Data Weave
Mule Esb Data WeaveMule Esb Data Weave
Mule Esb Data Weave
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connector
 
Filter expression in mule demo
Filter expression in mule demoFilter expression in mule demo
Filter expression in mule demo
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Cake PHP 3 Presentaion
Cake PHP 3 PresentaionCake PHP 3 Presentaion
Cake PHP 3 Presentaion
 
MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64MuleSoft ESB scatter-gather and base64
MuleSoft ESB scatter-gather and base64
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
 
Mule xml java
Mule xml javaMule xml java
Mule xml java
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
 

Destaque

Mule expression component
Mule expression componentMule expression component
Mule expression componentKarnam Karthik
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versionsAnirban Sen Chowdhary
 
Using groovy in mule
Using groovy in muleUsing groovy in mule
Using groovy in muleSon Nguyen
 
Collection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBCollection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBKiran Boddepalli
 
Using message enricher
Using message enricherUsing message enricher
Using message enricherSon Nguyen
 
Exception handling in mule
Exception handling in muleException handling in mule
Exception handling in mulenagarajupatangay
 
Mule exception strategies
Mule exception strategiesMule exception strategies
Mule exception strategiesKrishna_in
 
Mule Collection Aggregator
Mule Collection AggregatorMule Collection Aggregator
Mule Collection AggregatorAnkush Sharma
 
Handle exceptions in mule
Handle exceptions in muleHandle exceptions in mule
Handle exceptions in muleSon Nguyen
 
Mule Collection Splitter
Mule Collection SplitterMule Collection Splitter
Mule Collection SplitterAnkush Sharma
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in muleSon Nguyen
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Muleirfan1008
 

Destaque (20)

Mule message enricher
Mule message enricherMule message enricher
Mule message enricher
 
Mule esb examples
Mule esb examplesMule esb examples
Mule esb examples
 
Mule expression component
Mule expression componentMule expression component
Mule expression component
 
Process file one after another
Process file one after anotherProcess file one after another
Process file one after another
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Using groovy in mule
Using groovy in muleUsing groovy in mule
Using groovy in mule
 
Mule property placeholder
Mule property placeholderMule property placeholder
Mule property placeholder
 
Collection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESBCollection Splitter Aggregator in Mule ESB
Collection Splitter Aggregator in Mule ESB
 
Using message enricher
Using message enricherUsing message enricher
Using message enricher
 
Exception handling in mule
Exception handling in muleException handling in mule
Exception handling in mule
 
Java components in Mule
Java components in MuleJava components in Mule
Java components in Mule
 
Mule exception strategies
Mule exception strategiesMule exception strategies
Mule exception strategies
 
Caching a simple way
Caching a simple wayCaching a simple way
Caching a simple way
 
Mule Collection Aggregator
Mule Collection AggregatorMule Collection Aggregator
Mule Collection Aggregator
 
Handle exceptions in mule
Handle exceptions in muleHandle exceptions in mule
Handle exceptions in mule
 
Mule Collection Splitter
Mule Collection SplitterMule Collection Splitter
Mule Collection Splitter
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in mule
 
Groovy demo
Groovy demoGroovy demo
Groovy demo
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 

Semelhante a Message enricher in mule

Semelhante a Message enricher in mule (20)

Basic example using message properties component
Basic example using message properties componentBasic example using message properties component
Basic example using message properties component
 
XML for bioinformatics
XML for bioinformaticsXML for bioinformatics
XML for bioinformatics
 
Aimaf
AimafAimaf
Aimaf
 
Choice component
Choice componentChoice component
Choice component
 
Wso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1stWso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1st
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Pdfforge org[1]
Pdfforge org[1]Pdfforge org[1]
Pdfforge org[1]
 
Rapid Prototyping with Solr
Rapid Prototyping with SolrRapid Prototyping with Solr
Rapid Prototyping with Solr
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
 
Apps1
Apps1Apps1
Apps1
 
Wildcard Filter
Wildcard FilterWildcard Filter
Wildcard Filter
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Conexion php
Conexion phpConexion php
Conexion php
 
Conexion php
Conexion phpConexion php
Conexion php
 
Mule xml parsing
Mule xml parsingMule xml parsing
Mule xml parsing
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
How to use Cache scope
How to use Cache scopeHow to use Cache scope
How to use Cache scope
 
C99
C99C99
C99
 
C99
C99C99
C99
 
Latihan form login
Latihan form loginLatihan form login
Latihan form login
 

Último

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 

Último (20)

Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 

Message enricher in mule

  • 1. *
  • 2. *One common scenario involves the need to enrich an incoming message with information that isn’t provided by the source system *Mule currently supports enrichment of flow variables and message headers only. *The “enrichment resource” can be any message processor, outbound connector, processor-chain or flow-ref. *By having inline enrich tags for multiple targets
  • 3. * <?xml version="1.0" encoding="UTF-8"?> * <mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" * xmlns:spring="http://www.springframework.org/schema/beans" * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" * xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-curre * http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd * http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd * http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd * http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd * http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd * http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"> * <http:listener-config name="HTTP_Listener_8124" host="localhost" port="8124" doc:name="HTTP Listener Configuration"/> * <data-mapper:config name="XML_To_XML" transformationGraphPath="xml_to_xml.grf" doc:name="XML_To_XML"/> * <http:request-config name="HTTP_Request_Configuration" host="localhost" port="8124" doc:name="HTTP Request Configuration"/> * <flow name="encricherFlow"> * <http:listener config-ref="HTTP_Listener_8124" path="/enricher" doc:name="HTTP"/> * <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/> * <enricher doc:name="Message Enricher"> * <flow-ref name="assign_state_using_zip" doc:name="get state variable"/> * <enrich target="#[sessionvariable:newState]" source="#[xpath://enrichedPayload/state]"/> * <!-- <enrich target="#[variable:newState]" source="#[xpath://enrichedPayload/state]"/> --> * <enrich target="#[variable:country]" source="#[xpath://enrichedPayload/country']"/> * </enricher> *
  • 4. * <logger doc:name="Logger"/> * <data-mapper:transform config-ref="XML_To_XML" doc:name="XML To XML"> * <data-mapper:input-arguments> * <data-mapper:input-argument key="CountryCode">#[flowVars.country]</data-mapper:input-argument> * <data-mapper:input-argument key="State">#[sessionVars.newState]</data-mapper:input-argument> * </data-mapper:input-arguments> * </data-mapper:transform> * </flow> * <sub-flow name="assign_state_using_zip"> * <expression-component doc:name="Andhra"><![CDATA[String response="<enrichedPayload>"; * if( xpath3("//address/zip").equals("518001")){ * response += "<state>AP</state>"; * } * else if(xpath3("//address/zip").equals("500001")){ * response += "<state>TS</state>"; * } * else{ * response += "<state>INVALID STATE</state>"; * } * if( xpath3("//address/country").equalsIgnoreCase("INDIA")){ * response += "<country>+91</country>"; * } * else if(xpath3("//address/country").equalsIgnoreCase("UK")){ * response += "<state>+44</state>"; * } * else{ * response += "<state>INVALID Country</state>"; * } * response += "</enrichedPayload>"; *
  • 5. * payload = response; * System.out.println("Enriched Payload is::"+payload);]]></expression-component> * </sub-flow> * <flow name="complexencricherFlow"> * <http:listener config-ref="HTTP_Listener_8124" path="/complexenricher" doc:name="HTTP"/> * <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/> * <enricher doc:name="Message Enricher" target="#[flowVars.state]" source="#[xpath2://address/state]"> * <processor-chain doc:name="Processor Chain"> * <http:request config-ref="HTTP_Request_Configuration" path="/state" method="POST" doc:name="HTTP"/> * <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/> * </processor-chain> * </enricher> * <data-mapper:transform config-ref="XML_To_XML" doc:name="XML To XML"> * <data-mapper:input-arguments> * <data-mapper:input-argument key="State">#[flowVars.state]</data-mapper:input-argument> * </data-mapper:input-arguments> * </data-mapper:transform> * </flow> *
  • 6. * <flow name="muleencricherFlow"> * <http:listener config-ref="HTTP_Listener_8124" path="/state" doc:name="HTTP"/> * <mulexml:dom-to-xml-transformer doc:name="DOM to XML"/> * <expression-transformer doc:name="Expression"> * <return-argument evaluator="xpath2" expression="/address/zip"/> * </expression-transformer> * <choice doc:name="evaluate zip and assingn a state"> * <when expression="#[payload =='518001']"> * <set-payload value="&lt;address&gt;&lt;state&gt;AP&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/> * </when> * <when expression="#[payload =='500043']"> * <set-payload value="&lt;address&gt;&lt;state&gt;TS&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/> * </when> * <otherwise> * <set-payload value="&lt;address&gt;&lt;state&gt;Andhra&lt;/state&gt;&lt;/address&gt;" doc:name="Set Payload"/> * </otherwise> * </choice> * </flow> * </mule>