Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Camel ftp consumer ignores idempotent file repository on start

$
0
0
I have created a route that consumes from ftp:

private RouteDefinition ftpRouteOcs() {
IdempotentRepository<String> fileRep =
FileIdempotentRepository.fileIdempotentRepository(new
File("./downLoadedOcs"), A_MILLION, TEN_MB);
// from endpoint
FtpEndpoint<?> ftpEndpoint =
getContext().getEndpoint(config.ftpUrlOcs(), FtpEndpoint.class);
ftpEndpoint.setIdempotentKey("${file:name}");
ftpEndpoint.setIdempotentRepository(fileRep);
ftpEndpoint.getConfiguration().setBinary(true);
//important!
ftpEndpoint.getConfiguration().setStepwise(false);
// no write or move operations - read only, set idempotent to true
ftpEndpoint.setNoop(true);
// only include files that match pattern
ftpEndpoint.setInclude(OCS_FILE_FILTER_PATTERN);
// fetch 1000 files in one poll...
ftpEndpoint.setMaxMessagesPerPoll(FTP_MAX_FILES_PER_POLL);
// but sort ALL files before...
ftpEndpoint.setEagerMaxMessagesPerPoll(false);
// ...by file name
ftpEndpoint.setSortBy("file:name");
// to endpoint
FileEndpoint fileEndpoint = getContext().getEndpoint("file:" +
config.ftpTargetOcs(), FileEndpoint.class);
// mark finished downloads
fileEndpoint.setDoneFileName("${file:name}.done");
// ignore if exist
fileEndpoint.setFileExist(GenericFileExist.Ignore);
return
from(ftpEndpoint).to(fileEndpoint).routeId(RouteIds.ftpOcs.name());

As you see i am using fileIdempotentRepository. The file is created fine and
each file downloaded is added to the file - i get all related debug outputs.
The problem is after a restart all files are downloaded again - the
repository is ignored. The file is still there and on each run the file is
updated - with the same data (create date keeps the same, change date is
updated).
so what is be wrong with my setup?

Thanks in advance

Viewing all articles
Browse latest Browse all 5648

Trending Articles