Hi

The problem is that some of the examples on the wiki page are
extracted from real unit tests from the SVN and Apache just grabs from
trunk and thus Camel 2.0
where as it should grab it from the 1.x branch.

So use this header instead
org.apache.camel.file.name

I believe there is a constant for it on FileComponent in Camel 1.x



On Sun, Aug 16, 2009 at 4:42 PM, Kaver<[email protected]> wrote:
>
> Hello. I use Apache Camel 1.6.1.
>
> I've a route for writing messages from Processor to file:
> from("direct:text-file").to("file:///tmp/sts?noop=true");
>
> In Processor I call:
> ProducerTemplate template = exchange.getContext().createProducerTemplate();
> template.sendBody("direct:text-file", event.toString());
>
> This works fine except of file name, they are like this:
> /tmp/sts/ID-dru-amilo/40825-1250431613877/1-0
>
> I want to set a file name manually, to have them like:
> /tmp/sts/file.txt
>
> At http://camel.apache.org/file.html written:
> // set the output filename using java code logic, notice that this is done
> by setting
> // a special header property of the out exchange
> exchange.getOut().setHeader(Exchange.FILE_NAME, "report.txt");
>
> When I try this:
> template.sendBodyAndHeader("direct:text-file", event.toString(),
> Exchange.FILE_NAME, "event.log");
>
> I got:
> RequestProcessor.java:97: cannot find symbol
> symbol  : variable FILE_NAME
> location: interface org.apache.camel.Exchange
>                            Exchange.FILE_NAME, "event.log");
>
> What is wrong?
> --
> View this message in context: 
> http://www.nabble.com/File-component%3A-set-file-name-tp24994188p24994188.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to