Mobile

+916350664837

Flow Control – Scatter Gather

Introduction

Scatter Gather is a Routing Event Processor that receives a Mule event and sends a reference of this Mule event to each processing route.

Each request coming to Mule will be scattered across the routers to execute in parallel. Parallel processing starts and each router receives same set of payload.

Creates a new Mule event that combines all resulting Mule events from each route and passes the consolidated event to the next event processor , only after every route completes successfully.

Basics

It sends a request message to multiple targets concurrently. It then collects the responses from all routes and aggregates them back into a single response.

Scatter Gather Component

Uses

The Scatter-Gather component executes each route in parallel so greatly increase the efficiency of your Mule application

It may provide more information than sequential processing.

The Scatter-Gather component works with repeatable streams.

If used within transaction, it behaves as sequential because of BLOCKING_IO thread.

It is one of the Performant Integration Solutions in parallel processing.

Scatter Gather – Advanced

Execution Pattern

Scatter-Gather component should have at least two routes; otherwise, Mule application throws an exception and does not start.

It uses CPU_LITE (100% non BLOCKING) execution type reactive stream to optimize performance.

Scatter-Gather Threads

Concurrency Management

If “Max Concurrency” for scatter gather component is set to 1, then events across the routes will be executed sequentially.

It waits for the thread to be free and then executes the next route.

Scatter-Gather Max Concurrency

Target/Variable Management

In case when target variable is set, the mule event will be stored in it as variable. (here Example: 4 routes)

Transaction Control

When Scatter Gather component is part of transaction, it becomes sequential with BLOCKING execution type.

Scatter-Gather Transaction

Error Management

In case of failure of any one route, all the routes processing do not go to the next event processor but comes to scatter gather connector itself for exit.

On-error propagate or On error continue can be used as required in such cases.

References

https://docs.mulesoft.com/mule-runtime/4.3/scatter-gather-concept

Repo Link

https://github.com/integrationAssistance/Scatter-Gather.git

Leave a Reply

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

Related Post

Domain ProjectDomain Project

Introduction to Domain Project Domain Project is used to create shared resources which can be reused across other projects who are referring to domain projects. Mule can define selected connectors