Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The 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.

Available in Camel 1.5.

Example

In 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.

Wiki Markup
{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java}

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.

For full details, check the example source here:

camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java

Include Page
CAMEL:Using This Pattern
CAMEL:Using This Pattern