SlideShare a Scribd company logo
1 of 6
Collection Splitter-Aggregator in Mule ESB
Introduction:
CollectionSplitter- Asthe name says,it will splitsthe messageintoindividual messages.Eachindividual
message contains3 correlationproperties.
a. Mule correlationgroupsize – Whichis nothingbutthe payloadsize.
b. Mule correlationsequence–sequence numberof amessage.
c. Mule correlationId – Whichisthe unique idforthe entire group.Eachindividual message inthe
groupwill containthisid.
CollectionAggregator- Itwill aggregate the individualmessagesintocollection.The aggregationlogic
wouldhappenbasedonthe correlationdetails.
Let ushave a lookat the configurationof CollectionSplitter:
Enable Correlation: Thisfiledhas3 options.
a. IF_NOT_SET – This isthe default option.Itwill maintainthe existingcorrelationdetails.
b. ALWAYS– It will overridethe existingcorrelationdetails.
c. NEVER– No Actiononthe message properties.
Message InfoMapping:Thisfieldisusedtocreate a customcorrelationandmessage ids.It’soptional
Let ushave a lookat the configurationof CollectionAggregator:
Fail On Timeout–This fieldacceptsvaluesastrue/false.Defaultistrue.
If the value istrue thiscomponentwill throw the response timeoutexceptionafterthe specified
timeout.
If the value isfalse thenthe componentwill aggregate the incomplete results.
Timeout– Specifytime inmilliseconds.
Store Prefix –This isoptional.If the value isemptythenmule will create aunique store name forus.
How to Use:
1. Simple collectionsplitter-aggregator.
In the above flowdiagram,Splittercomponentwill splitthe booksobjectintoindividual
message andprocesseachbookobjectto nextmessage processor,the Aggregatorcomponent
will aggregate the updatedbooksprice object.The outcome of the Aggregatorcomponentwill
be the collectiontype.
Whenevermessagecomestosplittercomponent,itwillsplitthe messageandassignthe
correlationdetailstoeachobject/individual message.Aggregatorwill aggregate the results
basedon the correlationdetails.
Here,Mule will take of creatingcorrelationdetails.
2. Multiple Collectionsplitter-aggregatorsinthe same flowor in the subsequentsub flows.
Well,if we wantto use multiple splitter-aggregatorsinthe flow.The configurationwill be looks
like
If we runthis flow,thenwe wouldgetanunexpectedresult.Inthiscase,Mule will not
aggregate the resultscorrectly.
Let ussee why,
At the time of applicationstartup,mule will create alistable objectstore foreachcollection
aggregatorcomponentbasedonthe store prefix name.If we don’tprovide the store-prefix
name inthe configuration,Mule will create aunique store prefix name forus.The construction
of store-prefixlogicisdependsuponthe mule context, flow constructname andclassname of
the aggregator.
In the above flowdiagram,these twosplitter-aggregatorsare beingcalledfromthe same flow
(books-students-splitter-aggregator-flow),sothe flow constructname forthe bothof these
componentswill be same.Inthisscenario,Mule will create the same store name forbothof the
aggregatorcomponents.
Whenthe message comestoaggregator component, itwill checkthe correlationgroupalready
processedbythe correlationid(isthe objectstore containsthe correlationid).Inthe above
diagram,the firstaggregatorcomponent(bookaggregatorcomponent) wouldgive false butthe
secondaggregatorcomponent(studentaggregatorcomponent) wouldgivetrue because the
store namesare same.
i. If it returnsfalse,thenthe componentwill aggregate the resultsandaddthe
correlationidtothe store.
ii. If it returnstrue thenit will notaggregate the results.The message will be
movedtothe nextmessage processor.
That’s why,it’salwaysbettertogive the unique store prefix name forthe aggregator
componentasshownbelow.
3. Multiple CollectionSplitter-aggregatorsinforeachloop.
We can add ‘n’numberof aggregatorsby givingunique name tostore prefix.Whatwill happen,
if we use collectionaggregatorwithinfor-eachscope?
Whenthe message comesintofor-eachscope,itwill create correlationid,correlationsequence
and correlationgroupsize.For eachmessage,the correlationidwill be same.
Whenthe message comestocollectionaggregator,itwill checkwhetherthe groupisalready
processedforthe correlationid.If the groupisalreadyprocessedwiththe correlationidthen
the componentwill notaggregate the results.Sowe will notgetthe aggregatedresultsfromthe
2nd
message onwards.
To overcome thissituation,we have tomaintainunique correlationidforeachmessage inthe
for-loop.
Let ushave a lookat the belowconfiguration
In above diagram,the veryfirstcomponentinfor-eachscope isagroovyscript component
whichisusedto generate aunique correlationidasshownbelow.
By addingthe above linesin foreachscope,we can maintainthe unique correlationidforeach
message.
Finally,we gotthe aggregatedresultsbymaintainingthe correctcorrelationdetails.
Conclusion:
While usingthe Mule collectionsplitter-aggregator,we needtoconsiderthe below points.
1. We shoulduse the unique store prefix name.
2. We shouldmaintainthe uniquecorrelationidinforeachscope.
References:
http://forums.mulesoft.com/questions/25294/mule-collection-aggregator-is-unable-to-aggregate-
results-based-on-the-correlation_BAD.html
https://docs.mulesoft.com/mule-user-guide/v/3.7/splitter-flow-control-reference
Thank you

More Related Content

What's hot

Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBMani Rathnam Gudi
 
Mule Collection Splitter
Mule Collection SplitterMule Collection Splitter
Mule Collection SplitterAnkush Sharma
 
How to implement “multiple database(db) connection” in rails3
How to implement “multiple database(db) connection” in rails3How to implement “multiple database(db) connection” in rails3
How to implement “multiple database(db) connection” in rails3Andolasoft Inc
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_applicationRajarajan Sadhasivam
 
Mule system properties
Mule system propertiesMule system properties
Mule system propertiesGandham38
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4Ben Abdallah Helmi
 
Choice router mule
Choice router   muleChoice router   mule
Choice router muleSindhu VL
 
File connector mule
File connector   muleFile connector   mule
File connector muleSindhu VL
 
How To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxHow To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxBOSC Tech Labs
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering conceptsbapiraju
 
Cheat sheet soa_essentials
Cheat sheet soa_essentialsCheat sheet soa_essentials
Cheat sheet soa_essentialsxavier john
 
Sql server replication step by step
Sql server replication step by stepSql server replication step by step
Sql server replication step by steplaonap166
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering conceptsHarish43
 
Mysql creating stored function
Mysql  creating stored function Mysql  creating stored function
Mysql creating stored function Prof.Nilesh Magar
 

What's hot (20)

Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESB
 
Propertiesinmule
PropertiesinmulePropertiesinmule
Propertiesinmule
 
Mule Collection Splitter
Mule Collection SplitterMule Collection Splitter
Mule Collection Splitter
 
Mule jms
Mule   jmsMule   jms
Mule jms
 
How to implement “multiple database(db) connection” in rails3
How to implement “multiple database(db) connection” in rails3How to implement “multiple database(db) connection” in rails3
How to implement “multiple database(db) connection” in rails3
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_application
 
Mule: Java Transformer
Mule: Java TransformerMule: Java Transformer
Mule: Java Transformer
 
Mule system properties
Mule system propertiesMule system properties
Mule system properties
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
 
Choice router mule
Choice router   muleChoice router   mule
Choice router mule
 
File connector mule
File connector   muleFile connector   mule
File connector mule
 
How To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptxHow To Utilize Context API With Class And Functional Componen in React.pptx
How To Utilize Context API With Class And Functional Componen in React.pptx
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering concepts
 
Cheat sheet soa_essentials
Cheat sheet soa_essentialsCheat sheet soa_essentials
Cheat sheet soa_essentials
 
Sql server replication step by step
Sql server replication step by stepSql server replication step by step
Sql server replication step by step
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering concepts
 
Clustering concepts
Clustering conceptsClustering concepts
Clustering concepts
 
Mule security - saml
Mule  security - samlMule  security - saml
Mule security - saml
 
Mysql creating stored function
Mysql  creating stored function Mysql  creating stored function
Mysql creating stored function
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
 

Viewers also liked

Mule splitters
Mule splittersMule splitters
Mule splittersGandham38
 
Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scopekunal vishe
 
Mule data weave_5
Mule data weave_5Mule data weave_5
Mule data weave_5kunal vishe
 
Splitters in mule
Splitters in muleSplitters in mule
Splitters in mulevasanthii9
 
Mule Splitter Flow Control Reference
Mule Splitter Flow Control ReferenceMule Splitter Flow Control Reference
Mule Splitter Flow Control ReferenceAnkush Sharma
 
Mule JMS Transport
Mule JMS TransportMule JMS Transport
Mule JMS TransportRupesh Sinha
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routerssathyaraj Anand
 
Basic example using for each component
Basic example using for each componentBasic example using for each component
Basic example using for each componentprudhvivreddy
 
Basic example using file connector in anypoint studio
Basic example using file connector in anypoint studioBasic example using file connector in anypoint studio
Basic example using file connector in anypoint studioprudhvivreddy
 
Mule ESB Examples
Mule ESB ExamplesMule ESB Examples
Mule ESB ExamplesRaj Tomar
 
Mule flow and filter
Mule flow and filterMule flow and filter
Mule flow and filterSon Nguyen
 

Viewers also liked (20)

Splitting with mule
Splitting with muleSplitting with mule
Splitting with mule
 
Mule parsing with json part2
Mule parsing with json part2Mule parsing with json part2
Mule parsing with json part2
 
Mule parsing with json
Mule parsing with jsonMule parsing with json
Mule parsing with json
 
Mule splitters
Mule splittersMule splitters
Mule splitters
 
Mule scopes foreach_scope
Mule scopes foreach_scopeMule scopes foreach_scope
Mule scopes foreach_scope
 
Mule data weave_5
Mule data weave_5Mule data weave_5
Mule data weave_5
 
Message enricher in mule
Message enricher in muleMessage enricher in mule
Message enricher in mule
 
Mule esb examples
Mule esb examplesMule esb examples
Mule esb examples
 
How to use splitter component
How to use splitter componentHow to use splitter component
How to use splitter component
 
Splitters in mule
Splitters in muleSplitters in mule
Splitters in mule
 
Mule Splitter Flow Control Reference
Mule Splitter Flow Control ReferenceMule Splitter Flow Control Reference
Mule Splitter Flow Control Reference
 
Mule JMS Transport
Mule JMS TransportMule JMS Transport
Mule JMS Transport
 
Mule message processor or routers
Mule message processor or routersMule message processor or routers
Mule message processor or routers
 
Basic example using for each component
Basic example using for each componentBasic example using for each component
Basic example using for each component
 
Basic example using file connector in anypoint studio
Basic example using file connector in anypoint studioBasic example using file connector in anypoint studio
Basic example using file connector in anypoint studio
 
Mule ESB Examples
Mule ESB ExamplesMule ESB Examples
Mule ESB Examples
 
Mule flow and filter
Mule flow and filterMule flow and filter
Mule flow and filter
 
WebService with VM
WebService with VMWebService with VM
WebService with VM
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Json to json transformation in mule
Json to json transformation in muleJson to json transformation in mule
Json to json transformation in mule
 

Similar to Collection Splitter Aggregator in Mule ESB

Clustering in Machine Learning.pdf
Clustering in Machine Learning.pdfClustering in Machine Learning.pdf
Clustering in Machine Learning.pdfSudhanshiBakre1
 
Object Oriented Programming in Android Studio
Object Oriented Programming in Android StudioObject Oriented Programming in Android Studio
Object Oriented Programming in Android StudioMahmoodGhaemMaghami
 
5 Coding Hacks to Reduce GC Overhead
5 Coding Hacks to Reduce GC Overhead5 Coding Hacks to Reduce GC Overhead
5 Coding Hacks to Reduce GC OverheadTakipi
 
mule custom aggregator
mule   custom aggregatormule   custom aggregator
mule custom aggregatorPaolo Mojica
 
Managing stack traces
Managing stack tracesManaging stack traces
Managing stack tracesSon Nguyen
 
HPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialHPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialDirk Hähnel
 
A so common questions and answers
A so common questions and answersA so common questions and answers
A so common questions and answersAmit Sharma
 
Hyperion Essbase integration with ODI
Hyperion Essbase integration with ODIHyperion Essbase integration with ODI
Hyperion Essbase integration with ODIDharmaraj Borse
 
Data Partitioning for Ensemble Model Building
Data Partitioning for Ensemble Model BuildingData Partitioning for Ensemble Model Building
Data Partitioning for Ensemble Model Buildingneirew J
 
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDING
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDINGDATA PARTITIONING FOR ENSEMBLE MODEL BUILDING
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDINGijccsa
 

Similar to Collection Splitter Aggregator in Mule ESB (20)

Clustering in Machine Learning.pdf
Clustering in Machine Learning.pdfClustering in Machine Learning.pdf
Clustering in Machine Learning.pdf
 
Object Oriented Programming in Android Studio
Object Oriented Programming in Android StudioObject Oriented Programming in Android Studio
Object Oriented Programming in Android Studio
 
Ch03
Ch03Ch03
Ch03
 
A04
A04A04
A04
 
5 Coding Hacks to Reduce GC Overhead
5 Coding Hacks to Reduce GC Overhead5 Coding Hacks to Reduce GC Overhead
5 Coding Hacks to Reduce GC Overhead
 
Data structures
Data structuresData structures
Data structures
 
mule custom aggregator
mule   custom aggregatormule   custom aggregator
mule custom aggregator
 
Mallet
MalletMallet
Mallet
 
Managing stack traces
Managing stack tracesManaging stack traces
Managing stack traces
 
MyBatis
MyBatisMyBatis
MyBatis
 
Class diagram
Class diagramClass diagram
Class diagram
 
Backbone
BackboneBackbone
Backbone
 
HPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster TutorialHPC and HPGPU Cluster Tutorial
HPC and HPGPU Cluster Tutorial
 
A so common questions and answers
A so common questions and answersA so common questions and answers
A so common questions and answers
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
 
Hyperion Essbase integration with ODI
Hyperion Essbase integration with ODIHyperion Essbase integration with ODI
Hyperion Essbase integration with ODI
 
Data Partitioning for Ensemble Model Building
Data Partitioning for Ensemble Model BuildingData Partitioning for Ensemble Model Building
Data Partitioning for Ensemble Model Building
 
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDING
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDINGDATA PARTITIONING FOR ENSEMBLE MODEL BUILDING
DATA PARTITIONING FOR ENSEMBLE MODEL BUILDING
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
Spring annotation
Spring annotationSpring annotation
Spring annotation
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Collection Splitter Aggregator in Mule ESB

  • 1. Collection Splitter-Aggregator in Mule ESB Introduction: CollectionSplitter- Asthe name says,it will splitsthe messageintoindividual messages.Eachindividual message contains3 correlationproperties. a. Mule correlationgroupsize – Whichis nothingbutthe payloadsize. b. Mule correlationsequence–sequence numberof amessage. c. Mule correlationId – Whichisthe unique idforthe entire group.Eachindividual message inthe groupwill containthisid. CollectionAggregator- Itwill aggregate the individualmessagesintocollection.The aggregationlogic wouldhappenbasedonthe correlationdetails. Let ushave a lookat the configurationof CollectionSplitter: Enable Correlation: Thisfiledhas3 options. a. IF_NOT_SET – This isthe default option.Itwill maintainthe existingcorrelationdetails. b. ALWAYS– It will overridethe existingcorrelationdetails. c. NEVER– No Actiononthe message properties. Message InfoMapping:Thisfieldisusedtocreate a customcorrelationandmessage ids.It’soptional Let ushave a lookat the configurationof CollectionAggregator:
  • 2. Fail On Timeout–This fieldacceptsvaluesastrue/false.Defaultistrue. If the value istrue thiscomponentwill throw the response timeoutexceptionafterthe specified timeout. If the value isfalse thenthe componentwill aggregate the incomplete results. Timeout– Specifytime inmilliseconds. Store Prefix –This isoptional.If the value isemptythenmule will create aunique store name forus. How to Use: 1. Simple collectionsplitter-aggregator. In the above flowdiagram,Splittercomponentwill splitthe booksobjectintoindividual message andprocesseachbookobjectto nextmessage processor,the Aggregatorcomponent will aggregate the updatedbooksprice object.The outcome of the Aggregatorcomponentwill be the collectiontype. Whenevermessagecomestosplittercomponent,itwillsplitthe messageandassignthe correlationdetailstoeachobject/individual message.Aggregatorwill aggregate the results basedon the correlationdetails. Here,Mule will take of creatingcorrelationdetails.
  • 3. 2. Multiple Collectionsplitter-aggregatorsinthe same flowor in the subsequentsub flows. Well,if we wantto use multiple splitter-aggregatorsinthe flow.The configurationwill be looks like If we runthis flow,thenwe wouldgetanunexpectedresult.Inthiscase,Mule will not aggregate the resultscorrectly. Let ussee why, At the time of applicationstartup,mule will create alistable objectstore foreachcollection aggregatorcomponentbasedonthe store prefix name.If we don’tprovide the store-prefix name inthe configuration,Mule will create aunique store prefix name forus.The construction of store-prefixlogicisdependsuponthe mule context, flow constructname andclassname of the aggregator. In the above flowdiagram,these twosplitter-aggregatorsare beingcalledfromthe same flow (books-students-splitter-aggregator-flow),sothe flow constructname forthe bothof these componentswill be same.Inthisscenario,Mule will create the same store name forbothof the aggregatorcomponents. Whenthe message comestoaggregator component, itwill checkthe correlationgroupalready processedbythe correlationid(isthe objectstore containsthe correlationid).Inthe above diagram,the firstaggregatorcomponent(bookaggregatorcomponent) wouldgive false butthe secondaggregatorcomponent(studentaggregatorcomponent) wouldgivetrue because the store namesare same.
  • 4. i. If it returnsfalse,thenthe componentwill aggregate the resultsandaddthe correlationidtothe store. ii. If it returnstrue thenit will notaggregate the results.The message will be movedtothe nextmessage processor. That’s why,it’salwaysbettertogive the unique store prefix name forthe aggregator componentasshownbelow. 3. Multiple CollectionSplitter-aggregatorsinforeachloop. We can add ‘n’numberof aggregatorsby givingunique name tostore prefix.Whatwill happen, if we use collectionaggregatorwithinfor-eachscope? Whenthe message comesintofor-eachscope,itwill create correlationid,correlationsequence and correlationgroupsize.For eachmessage,the correlationidwill be same. Whenthe message comestocollectionaggregator,itwill checkwhetherthe groupisalready processedforthe correlationid.If the groupisalreadyprocessedwiththe correlationidthen the componentwill notaggregate the results.Sowe will notgetthe aggregatedresultsfromthe 2nd message onwards. To overcome thissituation,we have tomaintainunique correlationidforeachmessage inthe for-loop. Let ushave a lookat the belowconfiguration
  • 5. In above diagram,the veryfirstcomponentinfor-eachscope isagroovyscript component whichisusedto generate aunique correlationidasshownbelow. By addingthe above linesin foreachscope,we can maintainthe unique correlationidforeach message. Finally,we gotthe aggregatedresultsbymaintainingthe correctcorrelationdetails. Conclusion:
  • 6. While usingthe Mule collectionsplitter-aggregator,we needtoconsiderthe below points. 1. We shoulduse the unique store prefix name. 2. We shouldmaintainthe uniquecorrelationidinforeachscope. References: http://forums.mulesoft.com/questions/25294/mule-collection-aggregator-is-unable-to-aggregate- results-based-on-the-correlation_BAD.html https://docs.mulesoft.com/mule-user-guide/v/3.7/splitter-flow-control-reference Thank you