camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Build a bean from a Master Detail flat file
Date Thu, 02 Dec 2010 22:03:19 GMT
On Tue, Nov 30, 2010 at 4:50 PM, Marco Bettiol <jamiro.it@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/

Mime
View raw message