camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <qu...@pronoia-solutions.com>
Subject Re: move alternate files to different folder
Date Tue, 24 May 2016 15:14:19 GMT
For the file producer, you can set the CamelFileName header and include the dynamic part there.

public class DynamicFileNameTest extends CamelTestSupport {

    @Override
    protected RoutesBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from( "direct://source")
                        .setHeader("CamelFileName", simple( "${header[MyTargetDir]}/${date:now:yyyyMMddHHmmssSSS}.txt"))
                        .to("file://target/out")
                        ;
            }
        };
    }

    @Test
    public void testDynamicRoute() throws Exception {
        template.sendBodyAndHeader( "direct://source", "Body One", "MyTargetDir", "dir1");
        template.sendBodyAndHeader( "direct://source", "Body Two", "MyTargetDir", "dir2");

    }
}

> On May 23, 2016, at 2:59 PM, pp <phillip.phan@gmail.com> wrote:
> 
> I am trying to move large amount of files into two different folders.  I want
> to move them alternately for now. From what I understand with camel router,
> I can use dynamic routing to do this.  Is this correct? Any inputs are
> greatly appreciated.
> 
> Thanks
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/move-alternate-files-to-different-folder-tp5782984.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message