I think you can set the message header of CamelFileName as you want before 
sending the message to the file endpoint.

-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Thursday, August 23, 2012 at 8:12 AM, German de la Cruz wrote:

> Hi group!
> 
> I've very little experience in Camel (about 8 hours!)
> 
> I think it's a very complete framework and very expressive.
> 
> I've a rookie doubt (I expect!!)
> 
> I've a file endpoint. I've used a chooser to discriminate differents
> components to process a message. But, I've a requiremnt of saving the file
> for audit purposes. Then, after process the message, I copy it to
> differents endpoints (.error, .zip, .b64, .notProcessed) This is only and
> example.
> 
> But, I'm not sure if files can be unique in name. Then, what I want to do
> is to rename the file in the endpoint in an unique way (for example, a
> timestamp). In the .error endpoint, I've made it, but, in the rest of the
> endpoints I can't!
> 
> I've tried to make a second endpoint, in a way to rename the file in the
> first one, but I didn't make it.
> 
> Any suggestions??
> 
> Thanks in advance
> 
> German.-
> 
> Here the code...
> 
> CamelContext context = new DefaultCamelContext();
> context.addRoutes(new RouteBuilder() {
> @Override
> public void configure() throws Exception {
> // I try to rename the file here....
> from("file://./var/endpoints/inbound?delete=true")
> .to("file://./var/endpoints/processed/");
> // Or here....
> from("file://./var/endpoints/processed?delete=true&moveFailed=.error/${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}")
> .choice()
> .when().simple("${file:ext} == 'zip'").bean(new Executor(),"publishZip")
> .to("file://./var/endpoints/processed/.zip")
> .when().simple("${file:ext} == 'b64'").bean(new Executor(),"publishB64")
> .to("file://./var/endpoints/processed/.b64")
> .otherwise()
> .to("file://./var/endpoints/processed/.notProcessed");
> }
> });
> context.start();



Reply via email to