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 <[email protected]> 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.