Wednesday, July 17, 2019

Splitting a message, and processing and gathering

This recipe will show you how you how to bankrupt a nitty-gritty into individual fragments, fulfill each fragment individually, and re-aggregate the processed exchanges hold up Into a single exchange. In EIP terms, this is know as a Composed subject Processor, and Is made up of a cabal of a Splitter and an Aggregated. How to do It In order to split and aggregate (Join) a message, combine a split digital subscriber line statement with an associated Congo as follows 1. localize an Segregationists Instance as describe In the Aggregating related messages recipe.For this example, we will reuse theSetAggregationStrategy implementation from that recipe 2. Define a fixing split block as per the r utmosteing a message into fragments recipe, breaking up the payload as you see extend through the use of an expression. Reference the Segregationists spokesperson through the system attribute in the split element $body) In the coffee berry DSL, refer to the Segregationists instance a s the minute parameter to the split() statement from(directin) . Split(body(), new Straightforwardness()) . End() . To(mockout) How it deedsWhen 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 end of the split block, It Is passed Into theAggregationStrategy for aggregation. When all of the fragments have been processed, the final aggregated message proceeds belt down the route from the split block. This Is different from the principle Splitter behavior, which forwards the original message to that statement after the split statement.TIP By default, all touch 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 more An Segregationists. When an exception is throw duri ng the processing of the fragment, the exchange will be immediately passed to Segregationists. It is then up to the strategy to decide what to do with this information.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.