How to create spring integration for more than 10 directories? In my case currently we are having 2 location to pool, which is easy that we can create 2 different file inbound adaptor per directory. In future if i want to pool more than 'n' number of directories i dont want to make any code changes. Just i want to change my configuration by adding extra directory path. Is there any dynamic way of creating spring integration flow for this use case? Am using spring boot 3.x version with spring integration 6.x dependencies. Any solution for this requirement?

I tried google it, and it does not work with latest spring integration.

1

There are 1 best solutions below

0
On

We have a solution for remote file protocols: https://docs.spring.io/spring-integration/reference/sftp/rotating-server-advice.html.

But for plain file system we have not implemented yet a directoryExpression: https://github.com/spring-projects/spring-integration/issues/7971. However you can follow the suggestion solutions over there via MessageSourceMutator advice implementation.

Another solution is to use a dynamic IntegrationFlow approach to register Files.inboundAdapter() for your dirs in a loop: https://docs.spring.io/spring-integration/reference/dsl/java-runtime-flows.html