Why is apache/camel deleting files after processing

37 views Asked by At

We are using Camel to read files and check the content of the files. We don't need to forward the files to an endpoint. Below the build we use for setting up Camel. The problem is that Camel deletes the files after having processed the files. How can we avoid the deletion of the files ?

public void configure() {
    from(
        file(inputDirectory).initialDelay(initialDelay).delete(false).antInclude("*.pdf").readLock("markerFile").readLockDeleteOrphanLockFiles(false).maxMessagesPerPoll(500))
        .routeId("signaturcheck")
        .throttle(8).timePeriodMillis(100)
        .process(checkFile)
        .log("File handled ${file:name}")
        .stop();
}
1

There are 1 answers

0
user2023141 On

It seems it's the "stop()" which is responsible that the files in the inputDirectory is deleted. so, we created a different configuration and that works without deleting the files.

public void configure() {
    from(
        file(inputDirectory).initialDelay(initialDelay).delete(false).antInclude("*.pdf").readLock("markerFile").readLockDeleteOrphanLockFiles(false).maxMessagesPerPoll(500))
        .routeId("signaturcheck")
        .throttle(1000).timePeriodMillis(100)
        .process(checkFile)
        .log("File handled ${file:name}")
        .to("stub:null?discardWhenFull=true");
}