0
votes

The following code sample is from what I understand the most basic "Hello World" Apache-Camel example. However, I am having difficulties with it.

When I run this project nothing happens; the files remain in the original location and my IDE does not return an exception. I would like to move all .txt files from one directory to another. The directories mentioned do exist on my machine as well. (C:/camels/inner)(C:/testing)

I feel there is a foolish mistake someplace in this code, any help would be appreciated.

package CamelProject;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws Exception
    {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder()
        {
            public void configure() throws Exception
            {
                from("file:C:\\testing?delete=true&include=.*.txt").to("file:C:\\camels\\inner");
            }
        });
        context.start();
        Thread.sleep(10000);
        context.stop();
    }
}
3
its perfectly working dude same code... instead of C: drive try for D: drive..and check - Naren
Changing to another drive did not help. Same result. - Douglas Tober
could you post total size of the txt files which are there in C:\\testing folder - Naren
@Naren There is only one txt file in that directory, it contains the text, "Hello World". - Douglas Tober
ok if you get the original issue then let us know.. - Naren

3 Answers

0
votes

This should work. It's likely due to a case sensitivity issue.

Please have a look that your files end with .txt, not .TXT.

If so, the regular expression just needs adjustment (I leave that as a challenge to you...)

0
votes

Thank you for all the responses. I ended up removing my ~/.m2/repository and re-compiling Camel.

When re-compiling I had to make sure to use set MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512m and mvn install -Pfastinstall from the directory where Camel's POM.xml file was located.

After this process I copied the above code into a new project and it worked like a charm.

0
votes

For me the problem was the sleep time. It was too short that the main running thread didn't let Camel threads start. I changed the sleep time to 100000 (100,000) and it worked just fine.