THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Wiki Markup |
---|
{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java} |
Using the Spring XML Extensions
Code Block |
---|
<route>
<from uri="direct:start"/>
<split>
<simple>body</simple>
<choice>
<when>
<simple>${bean:orderItemHelper.isWidget}</simple>
<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 OrderItems
to a Content Based Router which checks the item type. Widget items get sent for checking in the widgetInventory
bean and gadgets get sent to the gadgetInventory
bean. Once these OrderItems
have been validated by the appropriate bean, they are sent on to the Aggregator which collects and re-assembles the validated OrderItems
into an order again.
...