You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2010/12/02 23:03:19 UTC

Re: Build a bean from a Master Detail flat file

On Tue, Nov 30, 2010 at 4:50 PM, Marco Bettiol <ja...@gmail.com> wrote:
> I have one flat file with the following structure:
>
> ----------------------------
> //Order Headers
> header A
> header B
> ...
> --------------------------
> //OrderDetails
> detail A.1
> detail B.1
> detail B.2
> ....
>
> in other word I have a file where at the beginning I can find the orders
> headers and then the orders details.
> I successfully mapped the OrderHeader from flat file to a java bean using
> bindy.
> The problem I do not know how to solve is how to process the order header
> with its own details togheter to create 1 "Order" bean containing both
> header and associated details.
>

You can always do custom mapping from a Camel Processor or Java Bean.
If the flat file contains N+ orders in the  same file. You can "spit
out" new messages from the Java code using Producer Template.
Then you can send the order using the producer template to the
"direct:order" endpoint.


from(file)
   .process(new MyCustomProcessor();

from("direct:order")
   .to("log:order")
    ...



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/