scatter gather component - mule

14
SCATTER-GATHER COMPONENT - MULE Presented By Sindhu VL

Upload: sindhu-vl

Post on 20-Jan-2017

228 views

Category:

Design


7 download

TRANSCRIPT

Page 1: Scatter gather component - mule

SCATTER-GATHER COMPONENT - MULE

Presented BySindhu VL

Page 2: Scatter gather component - mule

The routing message processor Scatter-Gather sends a request message to multiple targets concurrently. It collects the responses from all routes, and aggregates them into a single message.

Page 3: Scatter gather component - mule

SCATTER-GATHER BEHAVIOR AND EXCEPTIONS

Page 4: Scatter gather component - mule

The Scatter-Gather router sends a message for concurrent processing to all configured routes. The thread executing the flow that owns the router waits until all routes complete or time out.

If there are no failures, Mule aggregates the results from each of the routes into a message collection (MessageCollection class). Failure in one route does not stop the Scatter-Gather from sending messages to its other configured routes, so it is possible that many, or all routes may fail concurrently.

Page 5: Scatter gather component - mule

The Scatter-Gather router sends a message for concurrent processing to all configured routes. The thread executing the flow that owns the router waits until all routes complete or time out.

If there are no failures, Mule aggregates the results from each of the routes into a message collection (MessageCollection class). Failure in one route does not stop the Scatter-Gather from sending messages to its other configured routes, so it is possible that many, or all routes may fail concurrently.

Page 6: Scatter gather component - mule

COMPOSITEROUTINGEXCEPTION : The CompositeRoutingException is new

to the 3.5.0 Runtime. It extends the Mule MessagingException to aggregate exceptions from different routes in the context of a single message router. Exceptions are correlated to each route through a sequential ID.

Page 7: Scatter gather component - mule

This exception exposes two methods which allow you to obtain the IDs of failed routes and the exceptions returned by each route.

The getExceptions method returns a map where the key is an integer that identifies the index of the failed route, and the value is the exception itself.

The getExceptionForRouteIndex(int) method returns the exception of the requested route ID.

Page 8: Scatter gather component - mule

CUSTOMIZING AGGREGATION STRATEGIES :

Scatter-Gather allows you to define a custom aggregation strategy which overrides its default aggregation strategy. Among other things, custom gathering strategies allow you to:

Discard message responses Merge message properties that originated in

different routes Discard failed messages without throwing an

exception Select only one from multiple responses

Page 9: Scatter gather component - mule

MODELING SCATTER-GATHER IN A FLOW :

Add a scatter-gather element to your flow, then, inside the dashed-line scope area of the scatter-gather element, drag and drop two or more message processors or connectors, placing them parallel to one another, as shown.

Page 10: Scatter gather component - mule
Page 11: Scatter gather component - mule

SCATTER-GATHER THREADING PROFILES : Scatter-Gather’s default threading profile is designed to

work in most scenarios, where the Scatter-Gather component is typically configured with between three to six routes. If the default threading profile is not best suited for your needs, Scatter-Gather allows you to define a custom threading profile for the component. Ultimately, the optimum threading profile depends on each application. For most scenarios, MuleSoft recommends that the number of threads in Scatter-Gather should be the result of the number of routes times the value of maxThreadsActive for the flow where Scatter-Gather resides.

maxThreadsActive for Scatter-Gather = number of routes in Scatter-GathermaxThreadsActive for flow

Page 12: Scatter gather component - mule

MIGRATING TO SCATTER-GATHER FROM THE ALL MESSAGE ROUTER :

If you are currently using All routers in your application, you may wish to replace them with Scatter-Gather routers. This section details the differences you need to be aware of when considering migration.

Page 13: Scatter gather component - mule

WHY MIGRATE? Scatter-Gather is a better option for

most cases migrating to Scatter-Gather now will

facilitate the transition to Mule 4

Page 14: Scatter gather component - mule

ThankYou!!!!!!!!!!