You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pp <ph...@gmail.com> on 2016/05/23 20:59:00 UTC
move alternate files to different folder
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.
Re: move alternate files to different folder
Posted by pp <ph...@gmail.com>.
Thanks for the info.
--
View this message in context: http://camel.465427.n5.nabble.com/move-alternate-files-to-different-folder-tp5782984p5783074.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: move alternate files to different folder
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
The simple test will send the files to <project dir>/target/out/(dir1|dir2).
BTW - the test is complete (minus the import statements). Paste it into a java file and run/play with it.
> On May 24, 2016, at 12:33 PM, pp <ph...@gmail.com> wrote:
>
> or does it send the file to //target/out/dir1? //target/out/dir2?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/move-alternate-files-to-different-folder-tp5782984p5783048.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
Re: move alternate files to different folder
Posted by pp <ph...@gmail.com>.
or does it send the file to //target/out/dir1? //target/out/dir2?
--
View this message in context: http://camel.465427.n5.nabble.com/move-alternate-files-to-different-folder-tp5782984p5783048.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: move alternate files to different folder
Posted by pp <ph...@gmail.com>.
based on the code in the configure method doesn't the camel router send the
file to //target/out?
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/move-alternate-files-to-different-folder-tp5782984p5783047.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: move alternate files to different folder
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
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 <ph...@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.