Scatter-Gather Router

In this session we will learn about choice router in MuleSoft. We will cover Scatter-Gather Router, Things to remember when connecting to external systems, HTTP Request, Choice connector and Scatter-Gather connector.

YouTube video

Things to remember when you want to connect to external systems

External Systems: Database, Salesforce , SFTP , any external Webservices etc. Gather the configuration details that are required to connect to that particular system. See what is the request that particular system is accepting. See what is the security that is required to connect to that system. See what is the type of response that the system return to us. Good to know how much time the system takes to respond to us , so that we can configure timeout response.

HTTP Request

Http Request is used to call other web-services. It can be placed only in “Process” area of flow/private-flow/sub-flow. We should make sure that we send all kind of proper inputs to Http Request component like URL, method, the input payload that the external web-service is expecting, various attributes like queryParams, headers etc.


The Choice router routes messages through a flow based in evaluating an expression. Only one of the routes in the Choice router executes, meaning that the first expression that evaluates to true triggers that route’s execution and the others are not checked. If none of the expressions are true , then it goes to default route .

  • Mandatory Config Details required: Expression is mandatory which checks some validation. The result of the expression should be either true or false nothing else.
  • Expression: empty but you can’t keep empty expression, it will not deploy your application.
  • Remember: If first condition is satisfied, then it will not go to other blocks. It will execute the first satisfied condition block and continue further.

Scatter-Gather Router

Scatter Gather sends the request message to multiple targets concurrently, it collects responses from various targets and aggregate them to single message. It executes routes concurrently instead of sequentially . But wait till all targets executes. Output payload is combination of all targets. And each target output has payload+attributes.

So its always best practice to wrap every target within Try-Block with On-Error Continue, So that you can handle the errors and complete the process successfully. Remember: If any of the targets fail inside scatter-gather , it will fail whole process. The total time taken to process all targets is the max time took by one of the targets.



Checkout our complete MuleSoft Training to learn all about MuleSoft. We have 15+ session for you with Final Project.

Amit Chaudhary
Amit Chaudhary

Amit Chaudhary is Salesforce Application & System Architect and working on Salesforce Platform since 2010. He is Salesforce MVP since 2017 and have 17 Salesforce Certificates.

He is a active blogger and founder of Apex Hours.

Articles: 466

Leave a Reply

Your email address will not be published. Required fields are marked *