camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: Write enriched data after a split in a file
Date Fri, 08 Mar 2013 00:43:33 GMT
Can you try to use the aggregator to put the transformed objects together before sending it
to the file ?


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, March 7, 2013 at 10:00 PM, Jean Francois LE BESCONT wrote:

> Hey all !
>  
> I have a csv file. I would like to process this file to enrich with data
> then write enriched line in output.
>  
> I process my file like this :
>  
> .from("file://mycsv.csv")
> .split() .tokenize("\n") .streaming() .unmarshal() .bindy(BindyType.Csv,
> AED.class) .process(eADProcessor) // This process modify the output of the
> current line (via exchange.getOut().setBody(exchangeModified)) .log(" after
> modification ${body}") .end() // end split .log("after split ${body}")
> .end(); // from
>  
> The log after modification show me element modified and log after split
> print the original content from the file. Is there a way to write in the
> process element visible out of the split ?
>  
> To solve this problem, I have do a redirection after the process :
>  
> [...]
> .process(eADProcessor)
> .to("direct:WriteLine")
>  
> And In this other route I have try different way of write line in file :
>  
> via the classic file in append :
>  
> from("direct:WriteLine")
> .to("file://out.csv&fileExist=Append")
>  
> It works fine but it is too slow for my purpose.
>  
> I tried with a recipientList ( has Claus suggested me :) )
>  
> from("direct:WriteLine")
> recipientList(simple("stream:file?fileName=out.csv"))
>  
> It works fine but the file is not released or close, and I can't move it
> while I don't kill java.
>  
> Is there a way to force camel to close streamwriter after the split for my
> example.
>  
> I think that I will post a ticket after with my whole project to share my
> work with camel starter !
>  
> Thanks !
>  
> JF  



Mime
View raw message