The Split EIP allows you to divide messages that contain multiple elements (such as lists, arrays, XML/JSON files, or multi-line texts) into smaller parts. Each item is processed individually within a flow, facilitating the handling of complex messages.
When to use Split?
Parameter | Description | Default value | Type |
|---|---|---|---|
| Expression | Defines how the input message should be split into smaller parts. | ExpressionDefinition | |
| AggregationStrategy | Defines how the results of the split messages will be combined back into a single message at the end of processing. | AggregationStrategy |
An aggregation strategy (Aggregation Strategy) is the method used to rejoin the results that were processed individually after the message split.
IMPORTANT
- Most used aggregation strategy: GroupedBodyAggregationStrategy (joins the bodies of messages into a list).
- Configuration in the Aggregation Strategy field: #class:org.apache.camel.processor.aggregate.GroupedBodyAggregationStrategy.
Check one by one the aggregation strategies you can use in Sensedia Integrations:
GroupedBodyAggregationStrategy: one of the most useful. Groups only the body (body) of incoming messages into a java.util.List. Simple and efficient for collecting results.
GroupedExchangeAggregationStrategy: similar to the previous one, but instead of grouping only the bodies, it groups the complete Exchange object (with headers, properties, etc.) into a java.util.List.
UseLatestAggregationStrategy: discards the previous aggregated message and always keeps the most recent one. Useful when only the last result of a process matters.
UseOriginalAggregationStrategy: discards the new message and always keeps the original one (the first one that started the aggregation). This is the default behavior of the Multicast EIP.
StringAggregationStrategy: a simple strategy that concatenates the message bodies (converted to string) into a single string, usually separated by a newline character.
The flow is initiated by a POST request sent to the /process endpoint.
The request body must contain a list of order IDs separated by commas, for example:
1001,1002,1003.
The Split EIP divides this list into individual elements, and each ID is processed separately in the log:
Processing order: 1001Processing order: 1002Processing order: 1003Finally, the GroupedBodyAggregationStrategy brings together all the processed items again into a single list.
We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more