camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean Francois LE BESCONT <jflebesc...@gmail.com>
Subject Write enriched data after a split in a file
Date Thu, 07 Mar 2013 14:00:15 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message