Is there a way to integrate spring (either using int-file: inbound-channel-adapter, or in any other way) to just check the directory for the file (preferably a match with the template) without polling, and if the file exists, the selection is processed further , and if itβs not, just close (I can use routers for conditional redirects). What I'm trying to achieve is to control the flow based on a simple one-time file check instead of polling like a file watcher. OR should I do this in Java using a service activator?
EDIT:
This is what I have 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 advise me how I can do it right? That!
source share