SlideShare a Scribd company logo
1 of 9
Understanding Routing in Mule
Routing
The Routing module reviews the different types of Routers and how Routers are
used to control how messages are sent and received by components. The message
can be route in different ways. Below are explained in this example.
• Splitters and Aggregators
• Collection splitter and Collection Aggregator
• Message chunk splitter and Message chunk aggregator
• Scatter gather
• For each
• Mule flows, Sub flows and flow reference
• Filters
Splitters
Splitters are used to split the message and process split messages in parallel.
After processing completed, those messages get aggregate by aggregator
components. Below is the splitters main flow diagram.
Above flow exposes a HTTP service to implement collection splitter and message
chunk splitter. This flow expects a query parameter ‘splitter’. If ‘splitter’ parameter
value is ‘collection’ then choice router routes the flow to collection splitter or if
the value is ‘chunk’ then it routes to message chunk splitter implementation.
Collection splitter and Collection Aggregator
Collection splitter is used to split collection object and process split messages individually.
Collection splitter expects a collection object as a payload. A java component has been used
to create a List object. Each object of List is routed to another flow via VM queue in one-way
mode.
In the below flow after logger component (which logs payload) we have two important
message processors. Resequencer and Collection Aggregator. While elements of List are
processing invidually, the elements may get change their order. Resequencer is used to
reorder the elements of List object. Collection Aggregator is used to aggregate the processed
invidual message payload.
Message chunk splitter and Message chunk Aggregator
We need to provide some message payload to split the message.
Message chunk splitter is used to chunk a message into a number of fixed-length messages
based on the Message Size you configure in the Message Chunk Spliter.
This splitter first convert the message into byte array then split this array into chunks. Each
chunked message is routed to another flow via VM queue in one-way mode.
Message Chunk Aggregator is used to aggregate the chunked messages. Byte Array to
String component needs to co
Scatter Gather
Scatter Gather is used to send a message to multiple endpoints concurrently. It collects
the response of all the routes and aggregate into a single message.
For Each
The Foreach scope splits a collection into elements and processes them iteratively through
the processors embedded in the scope, then returns the original message to the flow.
As For Each expects a collection object is expected a java component is used to generate a
List OBJECT
Main Flow, Sub Flow and Flow reference.
A mule flow (main flow) which accepts message source and message processor where
sub flow accepts only message processor. Sub flow can be called via flow reference
because it doesn't accept message source.
Sub flow runs completely in the same context of the flow that calls it, inheriting
transaction context, exception handler, all variables and headers, etc.
A Main flow has its own context, transaction context, exception handler, all variables and
headers etc.
Filters:
Filters are used to filter the message using mule expressions.
Above flow accepts a HTTP request and filters the message using Expression filter and also
throws an exception if Expression filter is not satisfied using Message Filter. Refer slide 9
Expression Filter allows you to right a Mule Expression. if the expression returns true then
the process continuous to next message processor. or else the flow get discarded without
throwing any exception. Here the condition is checking for payload instance is java.util.List or
not.
If we need to throw an exception when Expression Filter returns false, then Expression filter
needs wrapped up the Message Filter and throwOnUnaccecpted attribute should be true as
shown in below snippet.
<message-filter throwOnUnaccepted="true" doc:name="Message-filter-thow-exception">
<expression-filter expression="#[payload instanceof
com.techm.splitters.SplitterCollections]"/>
</message-filter>
Routing in mule

More Related Content

What's hot

What's hot (20)

Overview of Mule
Overview of MuleOverview of Mule
Overview of Mule
 
Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notifications
 
Mulesoft file connector
Mulesoft file connectorMulesoft file connector
Mulesoft file connector
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mule
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Mule esb2
Mule esb2Mule esb2
Mule esb2
 
Mule esb
Mule esbMule esb
Mule esb
 
Mule rabbitmq
Mule rabbitmqMule rabbitmq
Mule rabbitmq
 
Introduction to testing mule
Introduction to testing muleIntroduction to testing mule
Introduction to testing mule
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 
Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
 
Content based routing tutorial in mule
Content based routing tutorial in muleContent based routing tutorial in mule
Content based routing tutorial in mule
 
Data weave in mule
Data weave in muleData weave in mule
Data weave in mule
 
Mule batch job
Mule batch jobMule batch job
Mule batch job
 
File component in mule
File component in muleFile component in mule
File component in mule
 
Mule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce InterfaceMule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce Interface
 
Flows and subflows in mule
Flows and subflows in muleFlows and subflows in mule
Flows and subflows in mule
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 

Viewers also liked

Hipertensión pulmonar
Hipertensión pulmonarHipertensión pulmonar
Hipertensión pulmonar
Angela Meza
 

Viewers also liked (18)

ESB introduction using Mule
ESB introduction using MuleESB introduction using Mule
ESB introduction using Mule
 
Usando seu codigo java no mule part 1
Usando seu codigo java no mule part 1Usando seu codigo java no mule part 1
Usando seu codigo java no mule part 1
 
C3D Labs. Customers & Partners
C3D Labs. Customers & PartnersC3D Labs. Customers & Partners
C3D Labs. Customers & Partners
 
Business english
Business englishBusiness english
Business english
 
Estudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS ComumEstudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS Comum
 
Partes del ordenador
Partes del ordenadorPartes del ordenador
Partes del ordenador
 
Restful considerada prejudicial parte 2
Restful considerada prejudicial   parte 2Restful considerada prejudicial   parte 2
Restful considerada prejudicial parte 2
 
Part I: Massive Open Online Courses as Revolutionary Chance for Ukraine. Part...
Part I: Massive Open Online Courses as Revolutionary Chance for Ukraine. Part...Part I: Massive Open Online Courses as Revolutionary Chance for Ukraine. Part...
Part I: Massive Open Online Courses as Revolutionary Chance for Ukraine. Part...
 
Science Slam: Let's Make Science Interesting
Science Slam: Let's Make Science InterestingScience Slam: Let's Make Science Interesting
Science Slam: Let's Make Science Interesting
 
Nurdianto Wu Technical Consultant
Nurdianto Wu Technical ConsultantNurdianto Wu Technical Consultant
Nurdianto Wu Technical Consultant
 
Mule salesforce integration solutions
Mule  salesforce integration solutionsMule  salesforce integration solutions
Mule salesforce integration solutions
 
Κυστεοκήλη 3ου Βαθμού σε Συνδιασμό με Πρόπτωση Μήτρας 4ου Βαθμού
Κυστεοκήλη 3ου Βαθμού σε Συνδιασμό με  Πρόπτωση Μήτρας 4ου ΒαθμούΚυστεοκήλη 3ου Βαθμού σε Συνδιασμό με  Πρόπτωση Μήτρας 4ου Βαθμού
Κυστεοκήλη 3ου Βαθμού σε Συνδιασμό με Πρόπτωση Μήτρας 4ου Βαθμού
 
Hipertensión pulmonar
Hipertensión pulmonarHipertensión pulmonar
Hipertensión pulmonar
 
Projectes d'indagació.
Projectes d'indagació.Projectes d'indagació.
Projectes d'indagació.
 
Risk management during start up and commissioning of super critical once thro...
Risk management during start up and commissioning of super critical once thro...Risk management during start up and commissioning of super critical once thro...
Risk management during start up and commissioning of super critical once thro...
 
Aprendre química a partir de contextos pseudocientífics.
Aprendre química a partir de contextos pseudocientífics.Aprendre química a partir de contextos pseudocientífics.
Aprendre química a partir de contextos pseudocientífics.
 
Aυτόχθονες λαοί
Aυτόχθονες λαοίAυτόχθονες λαοί
Aυτόχθονες λαοί
 
αγγλια
αγγλιααγγλια
αγγλια
 

Similar to Routing in mule

Mule ESB Tutorial Part 2
Mule ESB Tutorial Part 2Mule ESB Tutorial Part 2
Mule ESB Tutorial Part 2
Srikanth N
 

Similar to Routing in mule (20)

Splitters in mule
Splitters in muleSplitters in mule
Splitters in mule
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Routing and filters
Routing and filtersRouting and filters
Routing and filters
 
M split
M splitM split
M split
 
M filtering
M filteringM filtering
M filtering
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in mule
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control reference
 
Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESB
 
Controlling message flow
Controlling message flowControlling message flow
Controlling message flow
 
Wcf routing kt
Wcf routing ktWcf routing kt
Wcf routing kt
 
Message Chunk Splitter And Aggregator With MuleSoft
Message Chunk Splitter And Aggregator With MuleSoftMessage Chunk Splitter And Aggregator With MuleSoft
Message Chunk Splitter And Aggregator With MuleSoft
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_components
 
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
 
Elements in a muleflow
Elements in a muleflowElements in a muleflow
Elements in a muleflow
 
Using flows for service orchestration
Using flows for service orchestrationUsing flows for service orchestration
Using flows for service orchestration
 
Mule ESB Tutorial Part 2
Mule ESB Tutorial Part 2Mule ESB Tutorial Part 2
Mule ESB Tutorial Part 2
 

Recently uploaded

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Routing in mule

  • 2. Routing The Routing module reviews the different types of Routers and how Routers are used to control how messages are sent and received by components. The message can be route in different ways. Below are explained in this example. • Splitters and Aggregators • Collection splitter and Collection Aggregator • Message chunk splitter and Message chunk aggregator • Scatter gather • For each • Mule flows, Sub flows and flow reference • Filters Splitters Splitters are used to split the message and process split messages in parallel. After processing completed, those messages get aggregate by aggregator components. Below is the splitters main flow diagram.
  • 3. Above flow exposes a HTTP service to implement collection splitter and message chunk splitter. This flow expects a query parameter ‘splitter’. If ‘splitter’ parameter value is ‘collection’ then choice router routes the flow to collection splitter or if the value is ‘chunk’ then it routes to message chunk splitter implementation.
  • 4. Collection splitter and Collection Aggregator Collection splitter is used to split collection object and process split messages individually. Collection splitter expects a collection object as a payload. A java component has been used to create a List object. Each object of List is routed to another flow via VM queue in one-way mode. In the below flow after logger component (which logs payload) we have two important message processors. Resequencer and Collection Aggregator. While elements of List are processing invidually, the elements may get change their order. Resequencer is used to reorder the elements of List object. Collection Aggregator is used to aggregate the processed invidual message payload. Message chunk splitter and Message chunk Aggregator We need to provide some message payload to split the message. Message chunk splitter is used to chunk a message into a number of fixed-length messages based on the Message Size you configure in the Message Chunk Spliter.
  • 5. This splitter first convert the message into byte array then split this array into chunks. Each chunked message is routed to another flow via VM queue in one-way mode. Message Chunk Aggregator is used to aggregate the chunked messages. Byte Array to String component needs to co Scatter Gather Scatter Gather is used to send a message to multiple endpoints concurrently. It collects the response of all the routes and aggregate into a single message.
  • 6.
  • 7. For Each The Foreach scope splits a collection into elements and processes them iteratively through the processors embedded in the scope, then returns the original message to the flow. As For Each expects a collection object is expected a java component is used to generate a List OBJECT Main Flow, Sub Flow and Flow reference. A mule flow (main flow) which accepts message source and message processor where sub flow accepts only message processor. Sub flow can be called via flow reference because it doesn't accept message source. Sub flow runs completely in the same context of the flow that calls it, inheriting transaction context, exception handler, all variables and headers, etc. A Main flow has its own context, transaction context, exception handler, all variables and headers etc.
  • 8. Filters: Filters are used to filter the message using mule expressions. Above flow accepts a HTTP request and filters the message using Expression filter and also throws an exception if Expression filter is not satisfied using Message Filter. Refer slide 9 Expression Filter allows you to right a Mule Expression. if the expression returns true then the process continuous to next message processor. or else the flow get discarded without throwing any exception. Here the condition is checking for payload instance is java.util.List or not. If we need to throw an exception when Expression Filter returns false, then Expression filter needs wrapped up the Message Filter and throwOnUnaccecpted attribute should be true as shown in below snippet. <message-filter throwOnUnaccepted="true" doc:name="Message-filter-thow-exception"> <expression-filter expression="#[payload instanceof com.techm.splitters.SplitterCollections]"/> </message-filter>