-2

I am new to Apache Camel Framework. I have to develop an application in Spring Boot and Camel which polls given directory repeatedly(even after the directory undergo any modifications, the poller should go on polling for another scheduled interval and so on. I found something like below code in camel.

public class FilePoller extends RouteBuilder {

@Override
public void configure() {
    from("file:H:\\InputFolder?delay=1000&noop=true")
    .process(new Processor() {
        public void process(Exchange msg) {
            File file = msg.getIn().getBody(File.class);
            //LOG.info("Processing file: " + file);
            System.out.println("Polling file:"+file);

        }

}); 
}

}

The above code only waits for 1 second and then execute the subsequent code without polling the directory.

Can anybody help me in developing a Spring Boot-Camel application that polls a directory or a file repeatedly every given interval of time. Thanks in advance

1 Answers1

-1

Refer this camel file component documentation.

https://github.com/apache/camel/blob/master/camel-core/src/main/docs/file-component.adoc

To integrate with Spring boot you need to use SB version < 2.0

Rajkumar
  • 122
  • 7