Reputation: 785
Given the code below, I would expect preventDuplicates(false)
to allow files with the same name and size and last modification to be processed. However, the code still acts as it this flag is true
in that only a file with a new name is accepted.
The API says Configure an AcceptOnceFileListFilter if preventDuplicates == true, otherwise - AcceptAllFileListFilter.
Which I assume to mean that AcceptAllFileListFilter
is being used automatically, however when setting a break-point on this filter, it is never hit.
The patternFilter
is also not working. *.csv
is also being processed.
Removing either/or preventDuplicates()
or patternFilter()
doesn't make any difference (assuming that a Filter Chain was causing the problem).
Can anyone explain why this is happening?
@SpringBootApplication
public class ApplicationTest {
public static void main(String[] args) {
ConfigurableApplicationContext ctx =
new SpringApplicationBuilder(ApplicationTest.class)
.web(WebApplicationType.NONE)
.run(args);
}
@Bean
public IntegrationFlow readBackUpFlow() {
return IntegrationFlows
.from(
Files
.inboundAdapter(new File("d:/temp/in"))
.patternFilter("*.txt")
.preventDuplicates(false)
.get(),
e -> e.poller(Pollers.fixedDelay(5000))
)
.log("File", m -> m)
.transform(Files.toStringTransformer())
.log("Content", m -> m)
.handle((p, h) -> h.get(FileHeaders.ORIGINAL_FILE, File.class))
.handle(Files.outboundAdapter(new File("d:/temp/done")).deleteSourceFiles(true))
.get();
}
}
Upvotes: 0
Views: 52
Reputation: 121462
Don't call get()
on that Files.inboundAdapter()
. It does some extra work in the getComponentsToRegister()
which is called by the framework at specific phase. So, that's how your filters are not applied to the target channel adapter.
Upvotes: 1