我正在尝试创建一个路由设置:
到目前为止,我已经提出了以下哪些内容并不起作用,例如我不知道如何防止文件被记录为在幂等回购中检索到的...
这是在正确的轨道上吗? :
//Copy to staging as temp file
from(routeConfig.getFrom() + getCommonEndpointSettings())
.routeId(routeConfig.getRouteId())
// Grab the correct length of the remote file
.setHeader(ORIGINAL_FILE_LENGTH, header(Exchange.FILE_LENGTH));
// Exclude all files oder than the specified number of hours
.filter(new FileModifiedSincePredicate(24))
//Copy to staging folder for validation
.to(routeConfig.getTo()+STAGING_FOLDER_NAME+"?fileName=${file:name}.temp")
// Check the file size, throws exception if file size doesn't match
.process(new FileSizeValidationProcessor() )
// If we get here all is good and we can strip off the .temp file ending so the below route picks up the file
.process(exchange -> {
final String createdFileName = exchange.getIn().getHeader(Exchange.FILE_NAME_PRODUCED, String.class);
final File createdFile = new File(createdFileName);
log.info("Removing .temp file ending from " + createdFile.getAbsolutePath());
createdFile.renameTo(new File(createdFile.getAbsolutePath().replace(".temp", "")));
});
// Copy non .temp files from staging folder to destination folder
from(routeConfig.getTo()+STAGING_FOLDER_NAME+"?delete=true&delay=30s&antExclude=*.temp")
.routeId("Copy Staging " +routeConfig.getRouteId())
.to(routeConfig.getTo())
.end();