.

Sunday, March 3, 2019

Splitting a message, and processing and gathering

This recipe will show you how you how to secern a kernel into individual fragments, process each fragment individu anyy, and re-aggregate the processed exchanges back Into a single exchange. In EIP terms, this is known as a Composed meaning Processor, and Is made up of a combination of a Splitter and an Aggregated. How to do It In order to split and aggregate (Join) a message, combine a split DSL statement with an associated Congo as follows 1. Define an Segregationists typeface as described In the Aggregating related messages recipe.For this example, we will reuse theSetAggregationStrategy carrying out from that recipe 2. Define a regular split block as per the Splitting a message into fragments recipe, breaking up the payload as you see fit with the use of an expression. Reference the Segregationists instance with the strategy attribute in the split element $body) In the java DSL, refer to the Segregationists instance as the second parameter to the split() statement from( s tudyin) . Split(body(), new Straightforwardness()) . End() . To(mockout) How it worksWhen an exchange reaches the split statement, It Is broken up Into Individual fragments as expected, each of which Is processed through the steps defined within the block. When each split fragments exchange reaches the suppress of the split block, It Is passed Into theAggregationStrategy for aggregation. When all of the fragments have been processed, the final aggregated message produce down the route from the split block. This Is different from the normal Splitter behavior, which frontwards the original message to that statement after the split statement.TIP By default, all bear upon Is performed by a single thread. You can parallelize the processing of each message fragment by using theparallelprocesslng option as described in the Processing split messages in parallel recipe. Theres much An Segregationists. When an exception is thrown during the processing of the fragment, the exchange will b e straightway passed to Segregationists. It is then up to the strategy to decide what to do with this information.

No comments:

Post a Comment