Search code examples
spring-integrationspring-integration-dsl

AcceptOnceFileListFilter is overriding SimplePatternFileListFilter in Spring Integration JAVA DSL


I have following code:

return IntegrationFlows
                .from(Files.inboundAdapter(new File("data"))
                        .filter(new SimplePatternFileListFilter("*.txt"))
                        .filter(new AcceptOnceFileListFilter<>()),
                        e -> e.poller(Pollers.fixedDelay("1000"))
                                .id("fileInboundChannelAdapter"))
                .split(new FileSplitter())
                .<Object, Class<?>>route(Object::getClass, m -> m.channelMapping(String.class, "tranform.input")).get();

My SimplePatternFileListFilter is not working, but if I remove AcceptOnceFileListFilter, it works fine.

Is it intended, that only one FileListerFilter can be passed? If yes, any workaround possible?


Solution

  • That's correct. Since we don't know how you are going to combine them and what is the order, therefore only one .filter() can be configured. However at the same time there is a CompositeFileListFilter and ChainFileListFilter for your choice to compose a set of filters. And the order there matters already.

    All the hard work underneath is delegated to the FileListFilterFactoryBean and the composition and mutually exclusivity is dictated by that one.

    I guess we need to provide more cleaner JavaDocs on the matter. Feel free to raise a JIRA and we will fix it soon.