2. *The Routing module reviews the different types of Routers and how
Routers are used to control how messages are sent and received by
components. The message can be route in different ways. Below are
explained in this example.
• Splitters and Aggregators
• Collection splitter and Collection Aggregator
• Message chunk splitter and Message chunk aggregator
• Scatter gather
• For each
• Mule flows, Sub flows and flow reference
• Filters
3. *Splitters are used to split the message and process split messages in
parallel. After processing completed, those messages get aggregate
by aggregator components. Below is the splitters main flow diagram.
*Below flow exposes a HTTP service to implement collection splitter
and message chunk splitter. This flow expects a query parameter
‘splitter’.
*If ‘splitter’ parameter value is ‘collection’ then choice router routes
the flow to collection splitter or if the value is ‘chunk’ then it routes
to message chunk splitter implementation.
4.
5. Collection splitter and Collection Aggregator:
*Collection splitter is used to split collection object and process split
messages individually. Collection splitter expects a collection object
as a payload. A java component has been used to create a List
object. Each object of List is routed to another flow via VM queue in
one-way mode.
6. *In the above flow after logger component (which logs payload) we
have two important message processors.
1. Resequencer
2. Collection Aggregator.
* While elements of List are processing invidually, the elements may
get change their order. Resequencer is used to reorder the elements
of List object. Collection Aggregator is used to aggregate the
processed invidual message payload.
7. Message chunk splitter and Message chunk
Aggregator:
*We need to provide some message payload to split the message.
*Message chunk splitter is used to chunk a message into a number of
fixed-length messages based on the Message Size.
8. *This splitter first convert the message into byte array then split this
array into chunks. Each chunked message is routed to another flow via
VM queue in one-way mode.
* Message Chunk Aggregator is used to aggregate the chunked
messages. Byte Array to String component needs to co
9. Scatter Gather:
*Scatter Gather is used to send a message to multiple endpoints
concurrently. It collects the response of all the routes and aggregate
into a single message.