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.

Reply via email to