Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Composed Message ProcessorThe Composed Message Processor from the EIP patterns allows you to process a composite message by splitting it up, routing the sub-messages to appropriate destinations and the re-aggregating the responses back into a single message.
In Camel we provide two solutions
The difference is when using only a Splitter it aggregates back all the splitted messages into the same aggregation group, eg like a fork/join pattern. Using the splitter alone is often easier and possibly a better solution. So take a look at this first, before involving the aggregator. Example using both Splitter and AggregatorIn this example we want to check that a multipart order can be filled. Each part of the order requires a check at a different inventory. Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
Using the Spring XML Extensions <route> <from uri="direct:start"/> <split> <simple>body</simple> <choice> <when> <method bean="orderItemHelper" method="isWidget"/> <to uri="bean:widgetInventory"/> </when> <otherwise> <to uri="bean:gadgetInventory"/> </otherwise> </choice> <to uri="seda:aggregate"/> </split> </route> <route> <from uri="seda:aggregate"/> <aggregate strategyRef="myOrderAggregatorStrategy" completionTimeout="1000"> <correlationExpression> <simple>header.orderId</simple> </correlationExpression> <to uri="mock:result"/> </aggregate> </route> To do this we split up the order using a Splitter. The Splitter then sends individual When an order is sent it contains a header with the order id. We use this fact when we aggregate, as we configure this For full details, check the example source here: camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java Example using only SplitterIn this example we want to split an incoming order using the Splitter eip, transform each order line, and then combine the order lines into a new order message. Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
Using XML If you use XML, then the <split> tag offers the strategyRef attribute to refer to your custom The bean with the methods to transform the order line and process the order as well: Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
And the Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20
Using This PatternIf you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. |