SlideShare a Scribd company logo
1 of 8
Scatter Gather - Enterprise Integration Pattern
Overview:
Scatter Gatherpatternis requiredwhenanapplicationneedstosendmessage/requesttomultiple
receiverandneedstoreceive responses fromthose.Sendingof message torecipientsisdone in
asynchronousway.Replymessage fromthose recipientsis receivedasynchronouslyalso.Afterreceiving
the repliesconsolidatedintoone messageandprocessedfurther.
Flow:
Example Implementation Situation:
Suppose forCompany‘A’,there isrequirementof some productsay‘P’. There are numbersof supplier
of thatproduct whoare registeredwith‘A’.Now ‘A’askedforaquotationfor‘P’ andsendmessage to
the registeredsuppliers.The registeredsuppliersonreceivingthe message sendquotationinresponse.
Amongall the quotationsone quotationisacceptedbasedonthe lowestprice forthatproduct.
Example relate with pattern:
Sendingmessage toall the suppliers –broadcastthe message bymessage routertothe recipients
[Scatter].
Receivingand choosingbestquotation –receive replymessage fromthe recipientsandapplyingrule to
accept message [Gather].
Why the pattern helpful in this scenario:
1> There are numbersof recipient toreceivethe message. Sosendingmessage one byone isnota
feasible solution.Sobroadcastingof message forall isagood optionsuchthat message sending
isasynchronousandtakeslesstime.
2> Sendingmessage toone recipientandwaitingforreplytosendthe message toanother
recipientisalsonotfeasiblealso.If there isanyexceptionthe processwillhamper.
3> If there is delayby anyreceivertoresponse,there will be noproblemto continue the process.
4> Similartosendingif receivingof message canbe done asynchronously,thatreduce time.
5> Withall the receivedmessage preparingone requiredmessage isalsobecomingeasy.
Mulesoft and Scatter-Gather:
Mulesoft AnyPointStudio5.30 has inbuildScatter-Gathercomponent.
Mule documentationonscattergathercomponentis available -
https://docs.mulesoft.com/mule-user-guide/v/3.7/scatter-gather
The Scatter-GatherComponentone cansend a message forconcurrentprocessingtoall registered
receiver. Forresponse,the flowwaitsforall the receivertoreply.We can settimeoutperiodtosaythe
flowtoaccept replyonlyupto that period.
For aggregationof messages,the componentprovidesoptiontoimplementcustomaggregation
strategy.
To do that we have to write javaimplementationinheriting org.mule.routing.AggregationStrategy.
The methodto override is -
publicMuleEventaggregate(AggregationContextcontext) throwsMuleException;
Receiverfailure situation-
If any receiverfails,Scatter-GatherComponentsetsthe exceptionpayloadaccordinglyforeachroute.It
throwsCompositeRoutingException,whichmapseachexceptiontoitscorresponding receiverbyunique
ID (route id). Fromthe exceptionwe cangetdetail informationonall the route.
Case Study 1 - Sequential vs asynchronous calling of recipient:
Sequential calling of recipient:
INFO 2015-12-04 20:22:05,940 [[scatter-gather].connector.file.mule.default.receiver.01]
org.mule.transport.file.FileMessageReceiver: Lockobtainedonfile:
C:Users527366AnypointStudioinfileabc.json
INFO 2015-12-04 20:22:05,979 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}Start at 1449240725978
INFO 2015-12-04 20:22:05,982 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req1Start at 1449240725982 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:22:06,191 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req1done at 1449240726191
payload:org.glassfish.grizzly.utils.BufferInputStream@ecfc1
INFO 2015-12-04 20:22:06,192 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req2Start at 1449240726191 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:22:06,201 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req2done at 1449240726201
payload:org.glassfish.grizzly.utils.BufferInputStream@11a30ae
INFO 2015-12-04 20:22:06,201 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req3Start at 1449240726201 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:22:06,210 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Req3done at 1449240726210
payload:org.glassfish.grizzly.utils.BufferInputStream@7184fd
INFO 2015-12-04 20:22:06,212 [[scatter-gather].seqflow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Completedat1449240726212
payload:[org.glassfish.grizzly.utils.BufferInputStream@ecfc1,
org.glassfish.grizzly.utils.BufferInputStream@11a30ae,
org.glassfish.grizzly.utils.BufferInputStream@7184fd]done
Total time taken 234 millisecond (mayvary)
The recipientsare executedsequentially.
Asynchronous calling of recipient:
INFO 2015-12-04 20:09:39,184 [[scatter-gather].connector.file.mule.default.receiver.01]
org.mule.transport.file.FileMessageReceiver:Lockobtainedonfile:
C:Users527366AnypointStudioinfileabc.json
INFO 2015-12-04 20:09:39,224 [[scatter-gather].scatter-gatherFlow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}Start at 1449239979222
INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.02]
org.mule.api.processor.LoggerMessageProcessor: Req2Start at 1449239979227 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.03]
org.mule.api.processor.LoggerMessageProcessor:Req3Start at 1449239979228 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.01]
org.mule.api.processor.LoggerMessageProcessor: Req1Start at 1449239979227 payload:{
"response":"ERROR",
"errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
}
INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.03]
org.mule.api.processor.LoggerMessageProcessor: Req3done at 1449239979449
payload:org.glassfish.grizzly.utils.BufferInputStream@1b950cc
INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.02]
org.mule.api.processor.LoggerMessageProcessor: Req2done at 1449239979449
payload:org.glassfish.grizzly.utils.BufferInputStream@111347a
INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.01]
org.mule.api.processor.LoggerMessageProcessor: Req1done at 1449239979449
payload:org.glassfish.grizzly.utils.BufferInputStream@3f1f69
INFO 2015-12-04 20:09:39,453 [[scatter-gather].scatter-gatherFlow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Completedat1449239979453
payload:[org.glassfish.grizzly.utils.BufferInputStream@3f1f69,
org.glassfish.grizzly.utils.BufferInputStream@111347a,
org.glassfish.grizzly.utils.BufferInputStream@1b950cc]done
Time taken 231 millisecond (mayvary)
The recipientsare executedasynchronously.
Case Study 2 – Scatter Gather with Custom Aggregation Strategy:
INFO 2015-12-07 14:01:29,925 [[sg-req4].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"A","qt":20}
INFO 2015-12-07 14:01:29,944 [[scatter-gather2].ScatterGatherWorkManager.01]
org.mule.api.processor.LoggerMessageProcessor: Req1 done at 1449477089944
payload:org.glassfish.grizzly.utils.BufferInputStream@14fd890
INFO 2015-12-07 14:01:30,924 [[sg-req5].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"B","qt":30}
INFO 2015-12-07 14:01:30,929 [[scatter-gather2].ScatterGatherWorkManager.02]
org.mule.api.processor.LoggerMessageProcessor: Req2 done at 1449477090928
payload:org.glassfish.grizzly.utils.BufferInputStream@199449e
INFO 2015-12-07 14:01:34,925 [[sq-req6].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"C","qt":50}
INFO 2015-12-07 14:01:34,931 [[scatter-gather2].ScatterGatherWorkManager.03]
org.mule.api.processor.LoggerMessageProcessor: Req3 done at 1449477094931
payload:org.glassfish.grizzly.utils.BufferInputStream@68a486
CALLING
INFO 2015-12-07 14:01:34,940 [[scatter-gather2].scatter-gatherFlow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Completed at 1449477094940
payload:{"qtr":"C","qt":50}done
We have 3 recipients(sayA,Band C).They receivedrequestforquote,andrespondaccordingly.SayA
has quoted20, B has quoted30 andC hasquoted50. We have our custom aggregationstrategywhich
has implementationtoaccept highestquote andproceedfurther.
If we lookat the above console outputwe cansee that the highestquote is50 by C and our application
has acceptedthat.
Case Study 3 – Scatter Gather with Custom Aggregation Strategy and timeout:
INFO 2015-12-07 14:20:05,455 [[sg-req4].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"A","qt":20}
INFO 2015-12-07 14:20:05,482 [[scatter-gather2].ScatterGatherWorkManager.01]
org.mule.api.processor.LoggerMessageProcessor: Req1 done at 1449478205482
payload:org.glassfish.grizzly.utils.BufferInputStream@ae35e3
INFO 2015-12-07 14:20:10,456 [[sg-req5].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"B","qt":30}
INFO 2015-12-07 14:20:10,462 [[scatter-gather2].ScatterGatherWorkManager.02]
org.mule.api.processor.LoggerMessageProcessor: Req2 done at 1449478210462
payload:org.glassfish.grizzly.utils.BufferInputStream@10e129
CALLING
INFO 2015-12-07 14:20:13,869 [[scatter-gather2].scatter-gatherFlow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor: Completed at 1449478213869
payload:{"qtr":"B","qt":30}done
INFO 2015-12-07 14:20:16,457 [[sq-req6].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: {"qtr":"C","qt":50}
We have 3 recipients(sayA,Band C).They receivedrequestforquote,andrespondaccordingly.SayA
has quoted20, B has quoted30 andC hasquoted50. We have our custom aggregationstrategywhich
has implementationtoaccepthighestquote andproceed further.Inthiscase we have a timeoutperiod
for the scattergather componentwhichsaysacceptand waitupto that periodforresponse anddiscard
any response receivedafterthatperiod.Inourexample forresponse A delaysminimumupto2
seconds,Bup to 7 secondsandC up to 13 seconds.Forscatter gathercomponenttimeoutperiodsets
for 12 seconds.Sointhisexample ourhighestquote 30is fromB withinthe time specifiedtoallow
receivingof response.
Case study 4 – Scatter Gather with Exception from recipient:
Scatter Gatherpatternprovidesthe feature thatflow doesnotgetaffectedif anyof the recipientsthrow
exception.The exceptionmessage isalsoavailable fromwhichwe canhave informationonfailure.
We can have the exceptionmessageinCustomAggregationStrategyImplementation.
The applicationof A is notrunningand the route index:0is for thatand route index:2 isfor C for which
the response came late (aftertimeoutperiod).
INFO 2015-12-07 18:21:09,503 [[sg-req5].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor:{"qtr":"B","qt":30}
INFO 2015-12-07 18:21:09,527 [[scatter-gather2].ScatterGatherWorkManager.02]
org.mule.api.processor.LoggerMessageProcessor:Req2done at1449492669526
payload:org.glassfish.grizzly.utils.BufferInputStream@1bf42cc
CALLING
route index:0
Exception:org.mule.api.transport.DispatchException:route number0 failedto be executed.Failedto
route eventvia endpoint:InterceptingChainLifecycleWrapper'wrapperfor processorchain 'null''
[
org.mule.api.processor.LoggerMessageProcessor@138953b,
org.mule.module.http.internal.request.DefaultHttpRequester@7df95e,
org.mule.api.processor.LoggerMessageProcessor@146e103
]. Message payload is oftype: String
route index:2
Exception:org.mule.api.transport.DispatchException:route number2 failedto be executed.Failedto
route eventvia endpoint:InterceptingChainLifecycleWrapper'wrapperfor processorchain 'null''
[
org.mule.api.processor.LoggerMessageProcessor@bd94b2,
org.mule.module.http.internal.request.DefaultHttpRequester@24b913,
org.mule.api.processor.LoggerMessageProcessor@16aadfc
]. Message payload is oftype: String
INFO 2015-12-07 18:21:12,938 [[scatter-gather2].scatter-gatherFlow.stage1.02]
org.mule.api.processor.LoggerMessageProcessor:Completedat1449492672938
payload:{"qtr":"B","qt":30}done
INFO 2015-12-07 18:21:15,501 [[sq-req6].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor:{"qtr":"C","qt":50}

More Related Content

Viewers also liked

Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBMani Rathnam Gudi
 
Confined spaces brief
Confined spaces briefConfined spaces brief
Confined spaces briefbobrobbo
 
Tubi̇sad 2014 e_ticaret-raporu
Tubi̇sad 2014 e_ticaret-raporuTubi̇sad 2014 e_ticaret-raporu
Tubi̇sad 2014 e_ticaret-raporuMustafa Kuğu
 
Estadística i pensament crític a la vida diària
Estadística i pensament crític a la vida diàriaEstadística i pensament crític a la vida diària
Estadística i pensament crític a la vida diàriaUniversitat de Barcelona
 
UB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The HypeUB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The Hypecd3c
 
Angles
AnglesAngles
Anglesy3ehps
 
Zen and the Art of Social Media
Zen and the Art of Social MediaZen and the Art of Social Media
Zen and the Art of Social MediaGolin
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрацияkaanow
 
Reconstruction lesson 6 redemption
Reconstruction lesson 6 redemptionReconstruction lesson 6 redemption
Reconstruction lesson 6 redemptioncothransteve
 
TVET transformation is a migration??
TVET transformation is a migration??TVET transformation is a migration??
TVET transformation is a migration??Bukhari Taib
 
Gioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietGioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietnhutunhien
 
High scholar 2
High scholar 2High scholar 2
High scholar 2Razib M
 
[Student exchange vietnam] Vietnamese language training
[Student  exchange vietnam] Vietnamese language training[Student  exchange vietnam] Vietnamese language training
[Student exchange vietnam] Vietnamese language trainingLinh MP. Pham
 

Viewers also liked (20)

Controlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESBControlling Message Flow - Mule ESB
Controlling Message Flow - Mule ESB
 
Confined spaces brief
Confined spaces briefConfined spaces brief
Confined spaces brief
 
Tubi̇sad 2014 e_ticaret-raporu
Tubi̇sad 2014 e_ticaret-raporuTubi̇sad 2014 e_ticaret-raporu
Tubi̇sad 2014 e_ticaret-raporu
 
Estadística i pensament crític a la vida diària
Estadística i pensament crític a la vida diàriaEstadística i pensament crític a la vida diària
Estadística i pensament crític a la vida diària
 
UB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The HypeUB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The Hype
 
Angles
AnglesAngles
Angles
 
Zen and the Art of Social Media
Zen and the Art of Social MediaZen and the Art of Social Media
Zen and the Art of Social Media
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрация
 
FATZO Summary
FATZO SummaryFATZO Summary
FATZO Summary
 
Korelasi
KorelasiKorelasi
Korelasi
 
STR1 SuperStars
STR1 SuperStarsSTR1 SuperStars
STR1 SuperStars
 
Reconstruction lesson 6 redemption
Reconstruction lesson 6 redemptionReconstruction lesson 6 redemption
Reconstruction lesson 6 redemption
 
1º trim 2016 boletin bibliografico
1º trim  2016 boletin bibliografico1º trim  2016 boletin bibliografico
1º trim 2016 boletin bibliografico
 
TVET transformation is a migration??
TVET transformation is a migration??TVET transformation is a migration??
TVET transformation is a migration??
 
Presentation egrek
Presentation egrekPresentation egrek
Presentation egrek
 
Gioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietGioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri viet
 
High scholar 2
High scholar 2High scholar 2
High scholar 2
 
Lab12
Lab12Lab12
Lab12
 
World War II
World War IIWorld War II
World War II
 
[Student exchange vietnam] Vietnamese language training
[Student  exchange vietnam] Vietnamese language training[Student  exchange vietnam] Vietnamese language training
[Student exchange vietnam] Vietnamese language training
 

Similar to Enterprise Integration Pattern - Mule Soft Scatter gather

Scylla Summit 2018: How Scylla Helps You to be a Better Application Developer
Scylla Summit 2018: How Scylla Helps You to be a Better Application DeveloperScylla Summit 2018: How Scylla Helps You to be a Better Application Developer
Scylla Summit 2018: How Scylla Helps You to be a Better Application DeveloperScyllaDB
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream ProcessingGuido Schmutz
 
oracle soa Examples
oracle soa Examplesoracle soa Examples
oracle soa Examplesxavier john
 
Improvements in OpenStack Integration for Application Developers
Improvements in OpenStack Integration for Application DevelopersImprovements in OpenStack Integration for Application Developers
Improvements in OpenStack Integration for Application DevelopersRico Lin
 
EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
EWD 3 Training Course Part 6: What Happens when a QEWD Application is StartedEWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
EWD 3 Training Course Part 6: What Happens when a QEWD Application is StartedRob Tweed
 
Deploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud FoundryDeploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud Foundrycornelia davis
 
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService FunctionalityEWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService FunctionalityRob Tweed
 
Example Risk RegisterExample Risk Register.xlsx WBS 1 20
Example Risk RegisterExample Risk Register.xlsx  WBS 1 20Example Risk RegisterExample Risk Register.xlsx  WBS 1 20
Example Risk RegisterExample Risk Register.xlsx WBS 1 20BetseyCalderon89
 
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...apidays
 
AWS Application Migration Service-Hands-On Guide
AWS Application Migration Service-Hands-On GuideAWS Application Migration Service-Hands-On Guide
AWS Application Migration Service-Hands-On GuideManas Mondal
 
Multiple awr reports_parser
Multiple awr reports_parserMultiple awr reports_parser
Multiple awr reports_parserJacques Kostic
 
Spinning your Drones with Cadence Workflows and Apache Kafka
Spinning your Drones with Cadence Workflows and Apache KafkaSpinning your Drones with Cadence Workflows and Apache Kafka
Spinning your Drones with Cadence Workflows and Apache KafkaPaul Brebner
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorialappserver.io
 
Build Your Own HiveMQ Extension
Build Your Own HiveMQ ExtensionBuild Your Own HiveMQ Extension
Build Your Own HiveMQ ExtensionHiveMQ
 
OpenText Live: Modeling your business processes to new ways of working
OpenText Live: Modeling your business processes to new ways of workingOpenText Live: Modeling your business processes to new ways of working
OpenText Live: Modeling your business processes to new ways of workingOpenText Portfolio
 
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...Codemotion
 
PAC 2020 Santorin - Andreas Grabner
PAC 2020 Santorin - Andreas Grabner PAC 2020 Santorin - Andreas Grabner
PAC 2020 Santorin - Andreas Grabner Neotys
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsVMware Tanzu
 
Blinded Stack Overflow: Just Another Common Technique
Blinded Stack Overflow: Just Another Common TechniqueBlinded Stack Overflow: Just Another Common Technique
Blinded Stack Overflow: Just Another Common TechniqueThomas Gregory
 

Similar to Enterprise Integration Pattern - Mule Soft Scatter gather (20)

Scylla Summit 2018: How Scylla Helps You to be a Better Application Developer
Scylla Summit 2018: How Scylla Helps You to be a Better Application DeveloperScylla Summit 2018: How Scylla Helps You to be a Better Application Developer
Scylla Summit 2018: How Scylla Helps You to be a Better Application Developer
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
 
oracle soa Examples
oracle soa Examplesoracle soa Examples
oracle soa Examples
 
Improvements in OpenStack Integration for Application Developers
Improvements in OpenStack Integration for Application DevelopersImprovements in OpenStack Integration for Application Developers
Improvements in OpenStack Integration for Application Developers
 
EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
EWD 3 Training Course Part 6: What Happens when a QEWD Application is StartedEWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started
 
Deploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud FoundryDeploy your Multi-tier Application in Cloud Foundry
Deploy your Multi-tier Application in Cloud Foundry
 
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService FunctionalityEWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
EWD 3 Training Course Part 45: Using QEWD's Advanced MicroService Functionality
 
Example Risk RegisterExample Risk Register.xlsx WBS 1 20
Example Risk RegisterExample Risk Register.xlsx  WBS 1 20Example Risk RegisterExample Risk Register.xlsx  WBS 1 20
Example Risk RegisterExample Risk Register.xlsx WBS 1 20
 
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...
apidays Australia 2022 - Spinning Your Drones with Cadence Workflows and Apac...
 
AWS Application Migration Service-Hands-On Guide
AWS Application Migration Service-Hands-On GuideAWS Application Migration Service-Hands-On Guide
AWS Application Migration Service-Hands-On Guide
 
Multiple awr reports_parser
Multiple awr reports_parserMultiple awr reports_parser
Multiple awr reports_parser
 
Spinning your Drones with Cadence Workflows and Apache Kafka
Spinning your Drones with Cadence Workflows and Apache KafkaSpinning your Drones with Cadence Workflows and Apache Kafka
Spinning your Drones with Cadence Workflows and Apache Kafka
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorial
 
Understanding angular meteor
Understanding angular meteorUnderstanding angular meteor
Understanding angular meteor
 
Build Your Own HiveMQ Extension
Build Your Own HiveMQ ExtensionBuild Your Own HiveMQ Extension
Build Your Own HiveMQ Extension
 
OpenText Live: Modeling your business processes to new ways of working
OpenText Live: Modeling your business processes to new ways of workingOpenText Live: Modeling your business processes to new ways of working
OpenText Live: Modeling your business processes to new ways of working
 
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...
Rafaëla Breed - Tracing performance of your service calls - Codemotion Amster...
 
PAC 2020 Santorin - Andreas Grabner
PAC 2020 Santorin - Andreas Grabner PAC 2020 Santorin - Andreas Grabner
PAC 2020 Santorin - Andreas Grabner
 
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense SolutionsSpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
SpringOne Tour: Spring Recipes: A Collection of Common-Sense Solutions
 
Blinded Stack Overflow: Just Another Common Technique
Blinded Stack Overflow: Just Another Common TechniqueBlinded Stack Overflow: Just Another Common Technique
Blinded Stack Overflow: Just Another Common Technique
 

Recently uploaded

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...apidays
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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 organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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.pptxHampshireHUG
 
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 Processorsdebabhi2
 
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 Scriptwesley chun
 
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)wesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

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...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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
 
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
 
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)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 

Enterprise Integration Pattern - Mule Soft Scatter gather

  • 1. Scatter Gather - Enterprise Integration Pattern Overview: Scatter Gatherpatternis requiredwhenanapplicationneedstosendmessage/requesttomultiple receiverandneedstoreceive responses fromthose.Sendingof message torecipientsisdone in asynchronousway.Replymessage fromthose recipientsis receivedasynchronouslyalso.Afterreceiving the repliesconsolidatedintoone messageandprocessedfurther. Flow: Example Implementation Situation: Suppose forCompany‘A’,there isrequirementof some productsay‘P’. There are numbersof supplier of thatproduct whoare registeredwith‘A’.Now ‘A’askedforaquotationfor‘P’ andsendmessage to the registeredsuppliers.The registeredsuppliersonreceivingthe message sendquotationinresponse. Amongall the quotationsone quotationisacceptedbasedonthe lowestprice forthatproduct. Example relate with pattern: Sendingmessage toall the suppliers –broadcastthe message bymessage routertothe recipients [Scatter]. Receivingand choosingbestquotation –receive replymessage fromthe recipientsandapplyingrule to accept message [Gather].
  • 2. Why the pattern helpful in this scenario: 1> There are numbersof recipient toreceivethe message. Sosendingmessage one byone isnota feasible solution.Sobroadcastingof message forall isagood optionsuchthat message sending isasynchronousandtakeslesstime. 2> Sendingmessage toone recipientandwaitingforreplytosendthe message toanother recipientisalsonotfeasiblealso.If there isanyexceptionthe processwillhamper. 3> If there is delayby anyreceivertoresponse,there will be noproblemto continue the process. 4> Similartosendingif receivingof message canbe done asynchronously,thatreduce time. 5> Withall the receivedmessage preparingone requiredmessage isalsobecomingeasy. Mulesoft and Scatter-Gather: Mulesoft AnyPointStudio5.30 has inbuildScatter-Gathercomponent. Mule documentationonscattergathercomponentis available - https://docs.mulesoft.com/mule-user-guide/v/3.7/scatter-gather The Scatter-GatherComponentone cansend a message forconcurrentprocessingtoall registered receiver. Forresponse,the flowwaitsforall the receivertoreply.We can settimeoutperiodtosaythe flowtoaccept replyonlyupto that period. For aggregationof messages,the componentprovidesoptiontoimplementcustomaggregation strategy. To do that we have to write javaimplementationinheriting org.mule.routing.AggregationStrategy. The methodto override is - publicMuleEventaggregate(AggregationContextcontext) throwsMuleException; Receiverfailure situation- If any receiverfails,Scatter-GatherComponentsetsthe exceptionpayloadaccordinglyforeachroute.It throwsCompositeRoutingException,whichmapseachexceptiontoitscorresponding receiverbyunique ID (route id). Fromthe exceptionwe cangetdetail informationonall the route.
  • 3. Case Study 1 - Sequential vs asynchronous calling of recipient: Sequential calling of recipient: INFO 2015-12-04 20:22:05,940 [[scatter-gather].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lockobtainedonfile: C:Users527366AnypointStudioinfileabc.json INFO 2015-12-04 20:22:05,979 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] }Start at 1449240725978 INFO 2015-12-04 20:22:05,982 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req1Start at 1449240725982 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] } INFO 2015-12-04 20:22:06,191 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req1done at 1449240726191 payload:org.glassfish.grizzly.utils.BufferInputStream@ecfc1 INFO 2015-12-04 20:22:06,192 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req2Start at 1449240726191 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] } INFO 2015-12-04 20:22:06,201 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req2done at 1449240726201 payload:org.glassfish.grizzly.utils.BufferInputStream@11a30ae INFO 2015-12-04 20:22:06,201 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req3Start at 1449240726201 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] } INFO 2015-12-04 20:22:06,210 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Req3done at 1449240726210 payload:org.glassfish.grizzly.utils.BufferInputStream@7184fd
  • 4. INFO 2015-12-04 20:22:06,212 [[scatter-gather].seqflow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Completedat1449240726212 payload:[org.glassfish.grizzly.utils.BufferInputStream@ecfc1, org.glassfish.grizzly.utils.BufferInputStream@11a30ae, org.glassfish.grizzly.utils.BufferInputStream@7184fd]done Total time taken 234 millisecond (mayvary) The recipientsare executedsequentially. Asynchronous calling of recipient: INFO 2015-12-04 20:09:39,184 [[scatter-gather].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver:Lockobtainedonfile: C:Users527366AnypointStudioinfileabc.json INFO 2015-12-04 20:09:39,224 [[scatter-gather].scatter-gatherFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] }Start at 1449239979222 INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.02] org.mule.api.processor.LoggerMessageProcessor: Req2Start at 1449239979227 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] } INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.03] org.mule.api.processor.LoggerMessageProcessor:Req3Start at 1449239979228 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"] } INFO 2015-12-04 20:09:39,228 [[scatter-gather].ScatterGatherWorkManager.01] org.mule.api.processor.LoggerMessageProcessor: Req1Start at 1449239979227 payload:{ "response":"ERROR", "errors":["contact shouldbe a 10 digitnumber","Date shouldbe avalidpastdate"]
  • 5. } INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.03] org.mule.api.processor.LoggerMessageProcessor: Req3done at 1449239979449 payload:org.glassfish.grizzly.utils.BufferInputStream@1b950cc INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.02] org.mule.api.processor.LoggerMessageProcessor: Req2done at 1449239979449 payload:org.glassfish.grizzly.utils.BufferInputStream@111347a INFO 2015-12-04 20:09:39,449 [[scatter-gather].ScatterGatherWorkManager.01] org.mule.api.processor.LoggerMessageProcessor: Req1done at 1449239979449 payload:org.glassfish.grizzly.utils.BufferInputStream@3f1f69 INFO 2015-12-04 20:09:39,453 [[scatter-gather].scatter-gatherFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Completedat1449239979453 payload:[org.glassfish.grizzly.utils.BufferInputStream@3f1f69, org.glassfish.grizzly.utils.BufferInputStream@111347a, org.glassfish.grizzly.utils.BufferInputStream@1b950cc]done Time taken 231 millisecond (mayvary) The recipientsare executedasynchronously. Case Study 2 – Scatter Gather with Custom Aggregation Strategy:
  • 6. INFO 2015-12-07 14:01:29,925 [[sg-req4].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"A","qt":20} INFO 2015-12-07 14:01:29,944 [[scatter-gather2].ScatterGatherWorkManager.01] org.mule.api.processor.LoggerMessageProcessor: Req1 done at 1449477089944 payload:org.glassfish.grizzly.utils.BufferInputStream@14fd890 INFO 2015-12-07 14:01:30,924 [[sg-req5].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"B","qt":30} INFO 2015-12-07 14:01:30,929 [[scatter-gather2].ScatterGatherWorkManager.02] org.mule.api.processor.LoggerMessageProcessor: Req2 done at 1449477090928 payload:org.glassfish.grizzly.utils.BufferInputStream@199449e INFO 2015-12-07 14:01:34,925 [[sq-req6].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"C","qt":50} INFO 2015-12-07 14:01:34,931 [[scatter-gather2].ScatterGatherWorkManager.03] org.mule.api.processor.LoggerMessageProcessor: Req3 done at 1449477094931 payload:org.glassfish.grizzly.utils.BufferInputStream@68a486 CALLING INFO 2015-12-07 14:01:34,940 [[scatter-gather2].scatter-gatherFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Completed at 1449477094940 payload:{"qtr":"C","qt":50}done We have 3 recipients(sayA,Band C).They receivedrequestforquote,andrespondaccordingly.SayA has quoted20, B has quoted30 andC hasquoted50. We have our custom aggregationstrategywhich has implementationtoaccept highestquote andproceedfurther. If we lookat the above console outputwe cansee that the highestquote is50 by C and our application has acceptedthat.
  • 7. Case Study 3 – Scatter Gather with Custom Aggregation Strategy and timeout: INFO 2015-12-07 14:20:05,455 [[sg-req4].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"A","qt":20} INFO 2015-12-07 14:20:05,482 [[scatter-gather2].ScatterGatherWorkManager.01] org.mule.api.processor.LoggerMessageProcessor: Req1 done at 1449478205482 payload:org.glassfish.grizzly.utils.BufferInputStream@ae35e3 INFO 2015-12-07 14:20:10,456 [[sg-req5].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"B","qt":30} INFO 2015-12-07 14:20:10,462 [[scatter-gather2].ScatterGatherWorkManager.02] org.mule.api.processor.LoggerMessageProcessor: Req2 done at 1449478210462 payload:org.glassfish.grizzly.utils.BufferInputStream@10e129 CALLING INFO 2015-12-07 14:20:13,869 [[scatter-gather2].scatter-gatherFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Completed at 1449478213869 payload:{"qtr":"B","qt":30}done INFO 2015-12-07 14:20:16,457 [[sq-req6].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"qtr":"C","qt":50} We have 3 recipients(sayA,Band C).They receivedrequestforquote,andrespondaccordingly.SayA has quoted20, B has quoted30 andC hasquoted50. We have our custom aggregationstrategywhich has implementationtoaccepthighestquote andproceed further.Inthiscase we have a timeoutperiod for the scattergather componentwhichsaysacceptand waitupto that periodforresponse anddiscard any response receivedafterthatperiod.Inourexample forresponse A delaysminimumupto2 seconds,Bup to 7 secondsandC up to 13 seconds.Forscatter gathercomponenttimeoutperiodsets for 12 seconds.Sointhisexample ourhighestquote 30is fromB withinthe time specifiedtoallow receivingof response.
  • 8. Case study 4 – Scatter Gather with Exception from recipient: Scatter Gatherpatternprovidesthe feature thatflow doesnotgetaffectedif anyof the recipientsthrow exception.The exceptionmessage isalsoavailable fromwhichwe canhave informationonfailure. We can have the exceptionmessageinCustomAggregationStrategyImplementation. The applicationof A is notrunningand the route index:0is for thatand route index:2 isfor C for which the response came late (aftertimeoutperiod). INFO 2015-12-07 18:21:09,503 [[sg-req5].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor:{"qtr":"B","qt":30} INFO 2015-12-07 18:21:09,527 [[scatter-gather2].ScatterGatherWorkManager.02] org.mule.api.processor.LoggerMessageProcessor:Req2done at1449492669526 payload:org.glassfish.grizzly.utils.BufferInputStream@1bf42cc CALLING route index:0 Exception:org.mule.api.transport.DispatchException:route number0 failedto be executed.Failedto route eventvia endpoint:InterceptingChainLifecycleWrapper'wrapperfor processorchain 'null'' [ org.mule.api.processor.LoggerMessageProcessor@138953b, org.mule.module.http.internal.request.DefaultHttpRequester@7df95e, org.mule.api.processor.LoggerMessageProcessor@146e103 ]. Message payload is oftype: String route index:2 Exception:org.mule.api.transport.DispatchException:route number2 failedto be executed.Failedto route eventvia endpoint:InterceptingChainLifecycleWrapper'wrapperfor processorchain 'null'' [ org.mule.api.processor.LoggerMessageProcessor@bd94b2, org.mule.module.http.internal.request.DefaultHttpRequester@24b913, org.mule.api.processor.LoggerMessageProcessor@16aadfc ]. Message payload is oftype: String INFO 2015-12-07 18:21:12,938 [[scatter-gather2].scatter-gatherFlow.stage1.02] org.mule.api.processor.LoggerMessageProcessor:Completedat1449492672938 payload:{"qtr":"B","qt":30}done INFO 2015-12-07 18:21:15,501 [[sq-req6].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor:{"qtr":"C","qt":50}