SlideShare a Scribd company logo
1 of 8
Transformers
sai
• Transformers convert message payloads to formats expected by their destinations
• A Transformer prepares a message to be processed through a Mule flow by enhancing or altering the
message header or message payload
• For example, if the message source that triggers your flow receives data in XML format, but a
downstream message processor requires JSON-formatted data
• one or more transformers positioned between the message source and the message processor can achieve
the necessary translation
Transformers Available in Studio
Script Transformers
Java Object Transformers
Content Transformers
SAP Transformers
Message and Variable Transformers
Creating Custom Transformers
1. Use a Transformer Annotation on a method.
2. The traditional Mule way of creating custom transformers by extending AbstractTransformer
custom transformer is a user-defined transformer class that implements org.mule.api.transformer.Transformer.
Your class can extend AbstractTransformer or AbstractMessageTransform
There are two ways to create a transformer.
The transformer is then configured as follows:
(OR)
@ContainsTransformerMethods // since Mule 3.0.1
public class MyTransformers {  
 @Transformer  
 public URL stringToURL(String string) throws MalformedURLException   {  
     return new java.net.URL(string);
  }
@Transformer
public List<URL> stringsToURLs(String string) throws MalformedURLException {    
 List<URL urls = new ArrayList<URL>();   
  for (StringTokenizer tokenizer = new StringTokenizer(string); tokenizer.hasMoreTokens();)   
  {       
  urls.add(new URL(tokenizer.nextToken()));     }   
  return urls;
}
}
@Transformer Annotation
public class HelloWorldTransformer extends AbstractMessageTransformer{
public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException {
@SuppressWarnings("unchecked")
List<employee> employee= (List<employee>) message.getPayload();
message.setOutboundProperty("a", "Hello sai");
for ( employee employee1 : employee) {
System.out.println(employee1.getEid());
System.out.println(employee1.getEmployeename());
System.out.println("******");
if (employee1.getEid()==1) {
System.out.println("i am first variable......");
message.setOutboundProperty("a", employee1.getEid());
}
}
message.setOutboundProperty("b", message.getPayload());
message.setPayload(employee);
return employee;
}
}
-- For example, to make the helloWorldTransformer
discoverable, you would define it as follows:
references
• https://docs.mulesoft.com/mule-user-guide/v/3.8/transformers
• https://docs.mulesoft.com/mule-user-guide/v/3.8/creating-custom-
transformers

More Related Content

What's hot

Mule xml to-jaxb object
Mule xml to-jaxb objectMule xml to-jaxb object
Mule xml to-jaxb objectAnkush Sharma
 
Mule Schema Validation Filter
Mule Schema Validation FilterMule Schema Validation Filter
Mule Schema Validation FilterAnkush Sharma
 
Mule flow processing strategies
Mule flow processing strategiesMule flow processing strategies
Mule flow processing strategiesD.Rajesh Kumar
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traceskunal vishe
 
Mule transformers
Mule transformersMule transformers
Mule transformersThang Loi
 
Elements in a muleflow
Elements in a muleflowElements in a muleflow
Elements in a muleflowThang Loi
 
Mule threading profile & processing strategy
Mule threading profile & processing strategyMule threading profile & processing strategy
Mule threading profile & processing strategychetan singhal
 
Mule JMS Transport
Mule JMS TransportMule JMS Transport
Mule JMS TransportRupesh Sinha
 
Xml to-object-transformer
Xml to-object-transformerXml to-object-transformer
Xml to-object-transformerSanni Kumar Pal
 
Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scopekunal vishe
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control referenceKrishna_in
 
Scatter gather component - mule
Scatter gather component - muleScatter gather component - mule
Scatter gather component - muleSindhu VL
 
Splitter and Collection Aggregator With Mulesoft
Splitter and Collection Aggregator With Mulesoft Splitter and Collection Aggregator With Mulesoft
Splitter and Collection Aggregator With Mulesoft Jitendra Bafna
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filtersGandham38
 
Mule Message Chunk Aggregator
Mule Message Chunk AggregatorMule Message Chunk Aggregator
Mule Message Chunk AggregatorAnkush Sharma
 
Mule esb flow processing strategies
Mule esb flow processing strategiesMule esb flow processing strategies
Mule esb flow processing strategieshimajareddys
 
Mule expression component
Mule expression componentMule expression component
Mule expression componentKarnam Karthik
 

What's hot (20)

Mule xml to-jaxb object
Mule xml to-jaxb objectMule xml to-jaxb object
Mule xml to-jaxb object
 
Mule Schema Validation Filter
Mule Schema Validation FilterMule Schema Validation Filter
Mule Schema Validation Filter
 
Mule flow processing strategies
Mule flow processing strategiesMule flow processing strategies
Mule flow processing strategies
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
 
Mule transformers
Mule transformersMule transformers
Mule transformers
 
Elements in a muleflow
Elements in a muleflowElements in a muleflow
Elements in a muleflow
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule threading profile & processing strategy
Mule threading profile & processing strategyMule threading profile & processing strategy
Mule threading profile & processing strategy
 
Mule JMS Transport
Mule JMS TransportMule JMS Transport
Mule JMS Transport
 
Xml to-object-transformer
Xml to-object-transformerXml to-object-transformer
Xml to-object-transformer
 
Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scope
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control reference
 
Scatter gather component - mule
Scatter gather component - muleScatter gather component - mule
Scatter gather component - mule
 
Splitter and Collection Aggregator With Mulesoft
Splitter and Collection Aggregator With Mulesoft Splitter and Collection Aggregator With Mulesoft
Splitter and Collection Aggregator With Mulesoft
 
Mule enricher
Mule enricher Mule enricher
Mule enricher
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
 
Scatter-Gather
Scatter-GatherScatter-Gather
Scatter-Gather
 
Mule Message Chunk Aggregator
Mule Message Chunk AggregatorMule Message Chunk Aggregator
Mule Message Chunk Aggregator
 
Mule esb flow processing strategies
Mule esb flow processing strategiesMule esb flow processing strategies
Mule esb flow processing strategies
 
Mule expression component
Mule expression componentMule expression component
Mule expression component
 

Similar to Ashok mule esb

Transformers in Mulesoft Anypoint
Transformers in Mulesoft AnypointTransformers in Mulesoft Anypoint
Transformers in Mulesoft Anypointakshay yeluru
 
A short introduction on anypoint transformers
A short introduction on anypoint transformersA short introduction on anypoint transformers
A short introduction on anypoint transformersSwapnil Sahu
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_componentsPaaras Baru
 
Mule any point studio
Mule any point studioMule any point studio
Mule any point studioSon Nguyen
 
Muletransformers
MuletransformersMuletransformers
Muletransformersvijaynerd
 
Mule transformers
Mule transformersMule transformers
Mule transformersThang Loi
 
Custom transformer and annotation
Custom transformer and annotationCustom transformer and annotation
Custom transformer and annotationSunil Kumar
 
Mule transformers
Mule transformersMule transformers
Mule transformersKrishna_in
 
Routing in mule
Routing in muleRouting in mule
Routing in mulevasanthii9
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationjorgesimao71
 
Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBMani Rathnam Gudi
 

Similar to Ashok mule esb (20)

Mule transformers
Mule transformersMule transformers
Mule transformers
 
Mule: Java Transformer
Mule: Java TransformerMule: Java Transformer
Mule: Java Transformer
 
Mule esb transformers
Mule esb transformersMule esb transformers
Mule esb transformers
 
Transformers in Mulesoft Anypoint
Transformers in Mulesoft AnypointTransformers in Mulesoft Anypoint
Transformers in Mulesoft Anypoint
 
A short introduction on anypoint transformers
A short introduction on anypoint transformersA short introduction on anypoint transformers
A short introduction on anypoint transformers
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_components
 
Mule any point studio
Mule any point studioMule any point studio
Mule any point studio
 
Muletransformers
MuletransformersMuletransformers
Muletransformers
 
Mule transformers
Mule transformersMule transformers
Mule transformers
 
Mule jms
Mule   jmsMule   jms
Mule jms
 
Mule message
Mule messageMule message
Mule message
 
Mule advanced
Mule advancedMule advanced
Mule advanced
 
Custom transformer and annotation
Custom transformer and annotationCustom transformer and annotation
Custom transformer and annotation
 
Mule transformers
Mule transformersMule transformers
Mule transformers
 
Mule esb
Mule esbMule esb
Mule esb
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
Mule esb overview
Mule esb overviewMule esb overview
Mule esb overview
 
quickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integrationquickguide-einnovator-11-spring-integration
quickguide-einnovator-11-spring-integration
 
Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESB
 
Mule esb2
Mule esb2Mule esb2
Mule esb2
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
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
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
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
 
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
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
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
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
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
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
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
 
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
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
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
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 

Ashok mule esb

  • 2. • Transformers convert message payloads to formats expected by their destinations • A Transformer prepares a message to be processed through a Mule flow by enhancing or altering the message header or message payload • For example, if the message source that triggers your flow receives data in XML format, but a downstream message processor requires JSON-formatted data • one or more transformers positioned between the message source and the message processor can achieve the necessary translation
  • 3. Transformers Available in Studio Script Transformers Java Object Transformers
  • 5. Creating Custom Transformers 1. Use a Transformer Annotation on a method. 2. The traditional Mule way of creating custom transformers by extending AbstractTransformer custom transformer is a user-defined transformer class that implements org.mule.api.transformer.Transformer. Your class can extend AbstractTransformer or AbstractMessageTransform There are two ways to create a transformer. The transformer is then configured as follows: (OR)
  • 6. @ContainsTransformerMethods // since Mule 3.0.1 public class MyTransformers {    @Transformer    public URL stringToURL(String string) throws MalformedURLException   {        return new java.net.URL(string);   } @Transformer public List<URL> stringsToURLs(String string) throws MalformedURLException {      List<URL urls = new ArrayList<URL>();      for (StringTokenizer tokenizer = new StringTokenizer(string); tokenizer.hasMoreTokens();)      {          urls.add(new URL(tokenizer.nextToken()));     }      return urls; } } @Transformer Annotation
  • 7. public class HelloWorldTransformer extends AbstractMessageTransformer{ public Object transformMessage(MuleMessage message, String outputEncoding) throws TransformerException { @SuppressWarnings("unchecked") List<employee> employee= (List<employee>) message.getPayload(); message.setOutboundProperty("a", "Hello sai"); for ( employee employee1 : employee) { System.out.println(employee1.getEid()); System.out.println(employee1.getEmployeename()); System.out.println("******"); if (employee1.getEid()==1) { System.out.println("i am first variable......"); message.setOutboundProperty("a", employee1.getEid()); } } message.setOutboundProperty("b", message.getPayload()); message.setPayload(employee); return employee; } } -- For example, to make the helloWorldTransformer discoverable, you would define it as follows: