SlideShare a Scribd company logo
1 of 12
Ankit Lawaniya
9/3/2017 Ankit Lawaniya 1
Mule Message Enricher is one of the scopes in Mule which allows the
current message to be augmented using data from a separate
resource, which we call the Enrichment Resource. The Mule
implementation of the Enrichment Resource (a source of data to
augment the current message) can be any message processor.
In simple language, we can say a message enricher
enriches the current payload with some additional message or
information and this is done without disturbing the current payload.
Enricher is used if the target system needs more information than the
source system can provide. It enriches the Mule message by calling an
external system or doing some transformation to the existing payload
and saving it into some scope of variable, like session, outbound, or
invocation, and the transformation happening in the enricher scope
doesn't affect the actual payload. Set-property: Save some information
extracted from payload or original payload to some invocation or
flow scope variable.
9/3/2017 Ankit Lawaniya 2
9/3/2017 Ankit Lawaniya 3
 The Mule Message Enricher is designed for performing interactions like
calling an outbound endpoint and bringing the result back to the main
flow, which will be used to add the additional information into the
existing payload.
 One common scenario involves the need to enrich an incoming message
with information that isn’t provided by the source system. You can use a
content enricher if the target system needs more information than the
source system can provide.
 Mule Message Enricher allows the current message to be used in
performing a particular task separately without disturbing the original
message. Mule Message Enricher is best used in the case when you do not
want to lose your existing payload.
Example: If, in your flow, if you need to call an external service with an HTTP
outbound/HTTP request component in middle of the flow after getting the
response from the HTTP external service call you will find that your current
payload is modified with the response of the external service, but you didn't
want to change or disturb the existing payload. In that case, we can wrap our
HTTP outbound/HTTP request component inside the enricher and it will
make a call to the external system, store the result and your existing payload
will not be modified.
9/3/2017 Ankit Lawaniya 4
Below is the step by step process to demonstrate
how Message Enricher works.
 Enricher sends a copy of the original message
into the processor.
 The original message waits.
 The copy is processed.
 The copy's response is a message.
 Part(s) of the response are added to part(s) of
the original message.
 The enriched message moves forward.
9/3/2017 Ankit Lawaniya 5
 The way in which the message is enriched (or modified) is by
explicitly configuring mappings (source->target) between the result
from the Enrichment Resource and the message using Mule
Expressions. Mule Expressions are used to both select the value to be
extracted from the result that comes back from the Enrichment
Resource (source) and to define where this value to be inserted into
the message (target). The default source, if not configured, is the
payload of the result from the Enrichment Resource.
The “enrichment resource” can be any message processor, outbound
connector, processor-chain, or flow-ref. If using an outbound-connector
then, of course, it should have a request-response exchange pattern.
9/3/2017 Ankit Lawaniya 6
 IMP Note: As only one component can reside inside Message Enricher,
use of processor chain is recommended if more components are needed to
reside inside Message Enricher.
Let’s walk through how to use Mule Message Enricher in application. In this
example, we are receiving the JSON Request consisting Employee data with
id and role of the employee through HTTP call from the REST client. Our
objective here is to add the additional information which is the name of the
employee to the source data. For this, we will be calling Database to get the
information about the employee name and that will be added in the
source JSON to be sent back to the user.
9/3/2017 Ankit Lawaniya 7
9/3/2017 Ankit Lawaniya 8
9/3/2017 Ankit Lawaniya 9
 Request:
{
"id": 1,
"role": "Application Developer"
}
 Response:
{
"id": 1,
"name": "Ankit",
"Role": "Application Developer"
}
9/3/2017 Ankit Lawaniya 10
9/3/2017 Ankit Lawaniya 11
9/3/2017 Ankit Lawaniya 12

More Related Content

Similar to Content enrichment using mule message enricher

Software performance testing_overview
Software performance testing_overviewSoftware performance testing_overview
Software performance testing_overview
Rohan Bhattarai
 

Similar to Content enrichment using mule message enricher (20)

Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questions
 
Composite source in mule
Composite source in muleComposite source in mule
Composite source in mule
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Synchronous and asynchronous software communication components
Synchronous and asynchronous software communication componentsSynchronous and asynchronous software communication components
Synchronous and asynchronous software communication components
 
Web 7 | HTTP Request and Response
Web 7 | HTTP Request and ResponseWeb 7 | HTTP Request and Response
Web 7 | HTTP Request and Response
 
M enrichment
M enrichmentM enrichment
M enrichment
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Mule enricher component
Mule enricher component Mule enricher component
Mule enricher component
 
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from TechlightningFrequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
 
Mule concepts
Mule conceptsMule concepts
Mule concepts
 
Software performance testing_overview
Software performance testing_overviewSoftware performance testing_overview
Software performance testing_overview
 
Content based routing using mule choice flow control
Content based routing using mule choice flow controlContent based routing using mule choice flow control
Content based routing using mule choice flow control
 
A short introduction on anypoint scopes
A short introduction on anypoint scopesA short introduction on anypoint scopes
A short introduction on anypoint scopes
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
Message structure
Message structureMessage structure
Message structure
 
Until successful scope in mule
Until successful scope in muleUntil successful scope in mule
Until successful scope in mule
 
Mule message structure
Mule message structureMule message structure
Mule message structure
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
Types of MessageRouting in Mule
Types of MessageRouting in MuleTypes of MessageRouting in Mule
Types of MessageRouting in Mule
 

More from Ankit Lawaniya

More from Ankit Lawaniya (9)

First successful-router
First successful-routerFirst successful-router
First successful-router
 
Iterative processing using the for each scope in
Iterative processing using the for each scope inIterative processing using the for each scope in
Iterative processing using the for each scope in
 
Improving performance with cache scope in mule
Improving performance with cache scope in muleImproving performance with cache scope in mule
Improving performance with cache scope in mule
 
Cors (cross origin request sharing) in mule
Cors (cross origin request sharing) in muleCors (cross origin request sharing) in mule
Cors (cross origin request sharing) in mule
 
Validation module in mule
Validation module in muleValidation module in mule
Validation module in mule
 
Schema validation filter (xml schema validation)
Schema validation filter (xml schema validation)Schema validation filter (xml schema validation)
Schema validation filter (xml schema validation)
 
Validate json schema component
Validate json schema componentValidate json schema component
Validate json schema component
 
Parse template transformer mule
Parse template transformer muleParse template transformer mule
Parse template transformer mule
 
Active mq read and write flow in mule
Active mq  read and write flow in muleActive mq  read and write flow in mule
Active mq read and write flow in mule
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 

Content enrichment using mule message enricher

  • 2. Mule Message Enricher is one of the scopes in Mule which allows the current message to be augmented using data from a separate resource, which we call the Enrichment Resource. The Mule implementation of the Enrichment Resource (a source of data to augment the current message) can be any message processor. In simple language, we can say a message enricher enriches the current payload with some additional message or information and this is done without disturbing the current payload. Enricher is used if the target system needs more information than the source system can provide. It enriches the Mule message by calling an external system or doing some transformation to the existing payload and saving it into some scope of variable, like session, outbound, or invocation, and the transformation happening in the enricher scope doesn't affect the actual payload. Set-property: Save some information extracted from payload or original payload to some invocation or flow scope variable. 9/3/2017 Ankit Lawaniya 2
  • 4.  The Mule Message Enricher is designed for performing interactions like calling an outbound endpoint and bringing the result back to the main flow, which will be used to add the additional information into the existing payload.  One common scenario involves the need to enrich an incoming message with information that isn’t provided by the source system. You can use a content enricher if the target system needs more information than the source system can provide.  Mule Message Enricher allows the current message to be used in performing a particular task separately without disturbing the original message. Mule Message Enricher is best used in the case when you do not want to lose your existing payload. Example: If, in your flow, if you need to call an external service with an HTTP outbound/HTTP request component in middle of the flow after getting the response from the HTTP external service call you will find that your current payload is modified with the response of the external service, but you didn't want to change or disturb the existing payload. In that case, we can wrap our HTTP outbound/HTTP request component inside the enricher and it will make a call to the external system, store the result and your existing payload will not be modified. 9/3/2017 Ankit Lawaniya 4
  • 5. Below is the step by step process to demonstrate how Message Enricher works.  Enricher sends a copy of the original message into the processor.  The original message waits.  The copy is processed.  The copy's response is a message.  Part(s) of the response are added to part(s) of the original message.  The enriched message moves forward. 9/3/2017 Ankit Lawaniya 5
  • 6.  The way in which the message is enriched (or modified) is by explicitly configuring mappings (source->target) between the result from the Enrichment Resource and the message using Mule Expressions. Mule Expressions are used to both select the value to be extracted from the result that comes back from the Enrichment Resource (source) and to define where this value to be inserted into the message (target). The default source, if not configured, is the payload of the result from the Enrichment Resource. The “enrichment resource” can be any message processor, outbound connector, processor-chain, or flow-ref. If using an outbound-connector then, of course, it should have a request-response exchange pattern. 9/3/2017 Ankit Lawaniya 6
  • 7.  IMP Note: As only one component can reside inside Message Enricher, use of processor chain is recommended if more components are needed to reside inside Message Enricher. Let’s walk through how to use Mule Message Enricher in application. In this example, we are receiving the JSON Request consisting Employee data with id and role of the employee through HTTP call from the REST client. Our objective here is to add the additional information which is the name of the employee to the source data. For this, we will be calling Database to get the information about the employee name and that will be added in the source JSON to be sent back to the user. 9/3/2017 Ankit Lawaniya 7
  • 10.  Request: { "id": 1, "role": "Application Developer" }  Response: { "id": 1, "name": "Ankit", "Role": "Application Developer" } 9/3/2017 Ankit Lawaniya 10