SlideShare a Scribd company logo
1 of 9
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 and Message Processing in Mulesoft

More Related Content

What's hot

Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensionsSoujanya V
 
Expression language
Expression languageExpression language
Expression languageSon Nguyen
 
Bindings of components in mule
Bindings of components in muleBindings of components in mule
Bindings of components in mulesathishmca143
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technologyTanmoy Barman
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSINGAaqib Hussain
 
JSP Scope variable And Data Sharing
JSP Scope variable And Data SharingJSP Scope variable And Data Sharing
JSP Scope variable And Data Sharingvikram singh
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtapVikas Jagtap
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
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 MuleSoftJitendra Bafna
 
Architectural patterns part 4
Architectural patterns part 4Architectural patterns part 4
Architectural patterns part 4assinha
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
JSP Processing
JSP ProcessingJSP Processing
JSP ProcessingSadhana28
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)Manisha Keim
 

What's hot (20)

Jsp sasidhar
Jsp sasidharJsp sasidhar
Jsp sasidhar
 
Implementing jsp tag extensions
Implementing jsp tag extensionsImplementing jsp tag extensions
Implementing jsp tag extensions
 
Expression language
Expression languageExpression language
Expression language
 
Bindings of components in mule
Bindings of components in muleBindings of components in mule
Bindings of components in mule
 
java Servlet technology
java Servlet technologyjava Servlet technology
java Servlet technology
 
Java servlets
Java servletsJava servlets
Java servlets
 
Mule java part-1
Mule java part-1Mule java part-1
Mule java part-1
 
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSINGINTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE  AND JSP PROCESSING
INTRODUCTION TO JSP,JSP LIFE CYCLE, ANATOMY OF JSP PAGE AND JSP PROCESSING
 
JSP Scope variable And Data Sharing
JSP Scope variable And Data SharingJSP Scope variable And Data Sharing
JSP Scope variable And Data Sharing
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
 
Jsp in Servlet by Rj
Jsp in Servlet by RjJsp in Servlet by Rj
Jsp in Servlet by Rj
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
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
 
Architectural patterns part 4
Architectural patterns part 4Architectural patterns part 4
Architectural patterns part 4
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
JSP Processing
JSP ProcessingJSP Processing
JSP Processing
 
Mule overview
Mule overviewMule overview
Mule overview
 
Jsp
JspJsp
Jsp
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 

Similar to Routing and Message Processing in Mulesoft

Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filtersGandham38
 
Routing in mule
Routing in muleRouting in mule
Routing in mulevasanthii9
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routerssathyaraj Anand
 
Message processor in mule
Message processor in muleMessage processor in mule
Message processor in muleSon Nguyen
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routersSon Nguyen
 
Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBMani Rathnam Gudi
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control referenceKrishna_in
 
Mule esb and_relevant_components
Mule esb and_relevant_componentsMule esb and_relevant_components
Mule esb and_relevant_componentsPaaras Baru
 
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 inAnkit Lawaniya
 
Elements in a muleflow
Elements in a muleflowElements in a muleflow
Elements in a muleflowThang Loi
 
Module 5 APP+Sess+Pres layer.pptx
Module 5 APP+Sess+Pres layer.pptxModule 5 APP+Sess+Pres layer.pptx
Module 5 APP+Sess+Pres layer.pptxSridharChowdary10
 
Using flows for service orchestration
Using flows for service orchestrationUsing flows for service orchestration
Using flows for service orchestrationSindhu VL
 
Elements in a mule flow
Elements in a mule flowElements in a mule flow
Elements in a mule flowSindhu VL
 

Similar to Routing and Message Processing in Mulesoft (20)

Mule routing and filters
Mule routing and filtersMule routing and filters
Mule routing and filters
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
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
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESB
 
Splitter flow control reference
Splitter flow control referenceSplitter flow control reference
Splitter flow control reference
 
Controlling message flow
Controlling message flowControlling message flow
Controlling message flow
 
Wcf routing kt
Wcf routing ktWcf routing kt
Wcf routing kt
 
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
 
Module 5 APP+Sess+Pres layer.pptx
Module 5 APP+Sess+Pres layer.pptxModule 5 APP+Sess+Pres layer.pptx
Module 5 APP+Sess+Pres layer.pptx
 
Using flows for service orchestration
Using flows for service orchestrationUsing flows for service orchestration
Using flows for service orchestration
 
Elements in a mule flow
Elements in a mule flowElements in a mule flow
Elements in a mule flow
 

More from VenkataNaveen Kumar

Difference between cxf Proxy_and cxf_jaxws
Difference between cxf Proxy_and cxf_jaxwsDifference between cxf Proxy_and cxf_jaxws
Difference between cxf Proxy_and cxf_jaxwsVenkataNaveen Kumar
 
Configuring mule jms_withweblogicjms
Configuring mule jms_withweblogicjmsConfiguring mule jms_withweblogicjms
Configuring mule jms_withweblogicjmsVenkataNaveen Kumar
 
MuleSoft Anypoint Studio - Essentials - Data Filtering
MuleSoft Anypoint Studio - Essentials - Data FilteringMuleSoft Anypoint Studio - Essentials - Data Filtering
MuleSoft Anypoint Studio - Essentials - Data FilteringVenkataNaveen Kumar
 

More from VenkataNaveen Kumar (6)

Difference between cxf Proxy_and cxf_jaxws
Difference between cxf Proxy_and cxf_jaxwsDifference between cxf Proxy_and cxf_jaxws
Difference between cxf Proxy_and cxf_jaxws
 
Configuring mule jms_withweblogicjms
Configuring mule jms_withweblogicjmsConfiguring mule jms_withweblogicjms
Configuring mule jms_withweblogicjms
 
Munit_in_mule_naveen
Munit_in_mule_naveenMunit_in_mule_naveen
Munit_in_mule_naveen
 
Thread Management In Mule
Thread Management In MuleThread Management In Mule
Thread Management In Mule
 
Mule soft csv_toxml
Mule soft csv_toxmlMule soft csv_toxml
Mule soft csv_toxml
 
MuleSoft Anypoint Studio - Essentials - Data Filtering
MuleSoft Anypoint Studio - Essentials - Data FilteringMuleSoft Anypoint Studio - Essentials - Data Filtering
MuleSoft Anypoint Studio - Essentials - Data Filtering
 

Recently uploaded

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
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
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
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.
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
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
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
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
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
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
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
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
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
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 ...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
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)
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
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
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
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...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Routing and Message Processing in Mulesoft

  • 1.
  • 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>