Is there a way in spring integration, (either using int-file:inbound-channel-adapter or any other means) to simply check a directory for file (preferably pattern match) without polling and if file exists, fetch it and process further and if it doesn't, simply quit (i can use routers for conditional redirects) .. the thing i'm trying to achieve is to control the flow based on a simple once-off file check instead of polling the directory like a file-watcher. OR will I have to do it in Java, using a service activator?
EDIT:
This is what I've got so far:
@Bean
public FileReadingMessageSource fileSource();
CompositeFileListFilter f=new CompositeFileListFilter();
f.addFilter(new SimplePatternFileListFilter("*.zip"));
FileReadingMessageSource fsource = new FileReadingMessageSource();
fsource.setDirectory(inputDir);
fsource.setFilter(f);
return fsource;
}
@Bean
public IntegrationFlow loadInput(){
return IntegrationFlows
.from(fileSource())
// .from(Files.inboundAdapter(inputDir)
// .patternFilter("*.zip"),
// e -> e.poller(Pollers
// .fixedDelay(20000)
// .maxMessagesPerPoll(1)))
.handle("inputLoaderService", "extractZip")
.handle("inputLoaderService", "readInputFile")
.enrichHeaders(s -> s.header("Content-Type", "application/json"))
.channel("requestChannel")
.get();
}
Could you please guide me as to how I can get this properly wired? Ta!