Search code examples
javaspringapacheapache-camelenterprise-integration

Understanding Enterprise Integration for Scatter Gather?


I'm looking to better understand multiple splitters, transformers and aggregation methods in the popular EIP scatter gather.

Use-case is I send in some XML that can correspond to a multitude of different types. I want to split on the type specified in the header (Different for each type) and run it through a specific transformer corresponding to each type.

Are there any good examples within Camel to do something like this?

Pseudo Code Idea

RouteBuilder to process the input XML

Split on the type

Dynamically redirect to proper splitter based on type

Dynamically redirect to proper transformer based on type

Aggregate

Return response

Solution

  • Yes, Whatever you are looking to achieve is possible using camel. I cannot able to provide you complete set, but can able to help you how each process has to done.

    --RouteBuilder to process the input XML : File Process refer this which will help you to read file from specific directory.

    --Split on the type : Splitter using xpath you can able to pick type.

    --Dynamically redirect to proper transformer based on type : Data format based on data format you can marshal/un-marshal any type of data.

    --Aggregate: Aggregate

    --Return response : Once above done you have result you can done what ever you has to done after that.