Message Chunk Splitter & Message Chunk Aggregator in Mule

Message Chunk Splitter & Message Chunk Aggregator in Mule

Message Chunk Splitter splits message in form of chunks or fixed size message.We need to define size of message in configuration settings of Message Chunk Splitter.

Message Chunk Aggregator aggregates the splitted message in original form.

The Aggregators module contains different types of aggregators capable of storing values and releasing them all together based on the configuration specified. An Aggregator is a component used to collect those values until a condition is met, then execute a processor’s chain with the list of aggregated elements as the payload.

An Aggregator is a pass-through router, meaning that the same message that is processed by the aggregator is going to be processed by the components that follow it. The only modifications are the addition of some message attributes that provide information about the aggregation.

The basic aggregator configuration consists of the definition of the value that will be aggregated (extracted from the message through an expression evaluation), a condition that defines when the aggregation is considered complete, and a processor chain that will be executed once that condition is met.

flow of Message Chunk Splitter & Message Chunk Aggregator

Message Chunk Splitter configuration :

splitted files are located in a folder named splitted in src/main/resources

Message chunk aggregator configuration : As i said, nothing is required to configure inside it, so leave as it is.

URL : http://localhost:8085/api/chunksplitter
Method : POST

Input :


Output :

XML project code :

<?xml version="1.0" encoding="UTF-8"?> <mule xmlns:file="" xmlns:dw="" xmlns:metadata="" xmlns:http="" xmlns:mulexml="" xmlns:wmq="" xmlns="" xmlns:doc="" xmlns:spring="" xmlns:xsi="" xsi:schemaLocation=""> <http:listener-config name="HTTP_Listener_Configuration" host="" port="8085" basePath="/api" doc:name="HTTP Listener Configuration"/> <file:connector name="File" writeToDirectory="./src/main/resources/splitter" autoDelete="false" streaming="false" validateConnections="true" doc:name="File"/> <flow name="test_messagechunksplitterFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/chunksplitter" doc:name="HTTP"/> <message-chunk-splitter messageSize="256" doc:name="Message Chunk Splitter"/> <file:outbound-endpoint path="./src/main/resources/splitter" connector-ref="File" responseTimeout="10000" mimeType="application/xml" doc:name="File"/> <message-chunk-aggregator failOnTimeout="true" doc:name="Message Chunk Aggregator"/> <set-payload value="#[payload]" doc:name="Set Payload"/> </flow> </mule>