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

More Related Content

PPTX
How to get http query parameters in mule
PPTX
Configurare https mule
PDF
MuleSoft ESB Message Enricher
PPTX
Configurare http mule
PPTX
Mule esb
PPT
Mule connector for ibm® as400
ODP
Mule ESB SMTP Connector Integration
PPT
Anypoint connectorfor ibm as 400
How to get http query parameters in mule
Configurare https mule
MuleSoft ESB Message Enricher
Configurare http mule
Mule esb
Mule connector for ibm® as400
Mule ESB SMTP Connector Integration
Anypoint connectorfor ibm as 400

What's hot (16)

PPTX
Choice component in mule
PPT
Mule security - spring security manager
PPTX
Mule message processor or routers
PPTX
Message properties component in mule
PPT
MuleSoft ESB Routes first-successful
PPTX
Basic example using for each component
PPTX
Mule esb data weave multi input data
PPTX
Mule Esb Data Weave
PPTX
Mule esb first http connector
PPTX
Filter expression in mule demo
PPTX
Mule esb :Data Weave
PPTX
Cake PHP 3 Presentaion
PPTX
MuleSoft ESB scatter-gather and base64
PPTX
Mule xml java
PPTX
Mule xml java
PPTX
For each component in mule
Choice component in mule
Mule security - spring security manager
Mule message processor or routers
Message properties component in mule
MuleSoft ESB Routes first-successful
Basic example using for each component
Mule esb data weave multi input data
Mule Esb Data Weave
Mule esb first http connector
Filter expression in mule demo
Mule esb :Data Weave
Cake PHP 3 Presentaion
MuleSoft ESB scatter-gather and base64
Mule xml java
Mule xml java
For each component in mule
Ad

Viewers also liked (20)

PPTX
Mule message enricher
PDF
Mule esb examples
PPTX
Mule expression component
PPTX
Process file one after another
PPTX
Simple groovy example in mule
PPTX
Getting anypoint studios all versions
PPTX
Using groovy in mule
PPTX
Mule property placeholder
DOCX
Collection Splitter Aggregator in Mule ESB
PPTX
Using message enricher
PPTX
Exception handling in mule
PPT
Java components in Mule
PPTX
Mule exception strategies
PPTX
Caching a simple way
PPTX
Mule Collection Aggregator
PPTX
Handle exceptions in mule
PPTX
Mule Collection Splitter
PPTX
Message processor in mule
PPTX
Groovy demo
PPTX
Groovy with Mule
Mule message enricher
Mule esb examples
Mule expression component
Process file one after another
Simple groovy example in mule
Getting anypoint studios all versions
Using groovy in mule
Mule property placeholder
Collection Splitter Aggregator in Mule ESB
Using message enricher
Exception handling in mule
Java components in Mule
Mule exception strategies
Caching a simple way
Mule Collection Aggregator
Handle exceptions in mule
Mule Collection Splitter
Message processor in mule
Groovy demo
Groovy with Mule
Ad

Similar to Message enricher in mule (20)

PPTX
Basic example using message properties component
KEY
Aimaf
PPTX
Choice component
PPT
Wso2 Scenarios Esb Webinar July 1st
PDF
Bootstrat REST APIs with Laravel 5
TXT
Pdfforge org[1]
PDF
Rapid Prototyping with Solr
PDF
Tomcat连接池配置方法V2.1
DOC
PPTX
Wildcard Filter
PPTX
Mule xml parsing
DOCX
Conexion php
DOCX
Conexion php
PPTX
Mule xml parsing
PPTX
Jersey framework
PPTX
How to use Cache scope
TXT
C99
TXT
C99
DOCX
Latihan form login
PPTX
PostgreSQL's Secret NoSQL Superpowers
Basic example using message properties component
Aimaf
Choice component
Wso2 Scenarios Esb Webinar July 1st
Bootstrat REST APIs with Laravel 5
Pdfforge org[1]
Rapid Prototyping with Solr
Tomcat连接池配置方法V2.1
Wildcard Filter
Mule xml parsing
Conexion php
Conexion php
Mule xml parsing
Jersey framework
How to use Cache scope
C99
C99
Latihan form login
PostgreSQL's Secret NoSQL Superpowers

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPT
Introduction Database Management System for Course Database
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
AI in Product Development-omnex systems
PDF
Digital Strategies for Manufacturing Companies
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
medical staffing services at VALiNTRY
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administration Chapter 2
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Transform Your Business with a Software ERP System
Design an Analysis of Algorithms I-SECS-1021-03
Introduction Database Management System for Course Database
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
AI in Product Development-omnex systems
Digital Strategies for Manufacturing Companies
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Odoo POS Development Services by CandidRoot Solutions
medical staffing services at VALiNTRY
Operating system designcfffgfgggggggvggggggggg
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administration Chapter 2
How Creative Agencies Leverage Project Management Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Softaken Excel to vCard Converter Software.pdf
history of c programming in notes for students .pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises

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>