On Fri, Sep 25, 2009 at 2:08 PM, swatkatz <[email protected]> wrote:
>
> Hi,
>
> I am trying to use the Camel file component to write to a single file but no
> matter what I do it always generates multiple files.
>
> My conf looks like the following -
>
> <route>
> <from
> uri="timer://consolidateEvents?fixedRate=true&period=60000"/>
> <bean ref="usageConsolidator" method="getConsolidatedEvents"/>
> <to uri="file://C:/Backup"/>
> </route>
>
> and I am setting
> exchange.getOut().setHeader(Exchange.FILE_NAME,"report.txt") in my
> usageConsolidator bean.
>
> I have tried -
>
> <route>
> <from
> uri="timer://consolidateEvents?fixedRate=true&period=60000"/>
> <bean ref="usageConsolidator" method="getConsolidatedEvents"/>
> <to uri="file://C:/Backup?fileName=report.txt"/>
> </route>
>
> but that doesn't work because I get exceptions that there was 1 parameter
> couldn't be set on the end point - [fileName].
>
> Any help would be appreciated.
Here's a route that generates a single file and always appends to that file:
<route>
<from uri="timer://myTimer?fixedRate=true&delay=0&period=2000" />
<bean ref="MyProcessor" method="process" />
<setHeader headerName="CamelFileName">
<constant>message.txt</constant>
</setHeader>
<to uri="file:/tmp/foo?fileExist=Append" />
</route>
Is this what you're seeking?
There are some additional options for the fileExist property listed here:
http://camel.apache.org/file2.html#File2-Produceronly
Bruce
--
perl -e 'print
unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'
ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder