spring-bootspring-integrationspring-integration-dslspring-dslspring-integration-ftp

Spring Integration DSL FTP


I have Spring inbound for the FTP

I am looking at the document

https://docs.spring.io/spring-integration/reference/html/ftp.html

If you happened to have one or more files sitting in the local-directory, it would process those files before it would initiate communication with the remote FTP server.

What exactly the above means?

For example, in my case, local directory is the one which other flow will pick up from. For example, I have 5 files in that directory that have not been picked up by other flow.

Why would FTP adaptor try to process them again and what exactly it will do? How can I stop that?


Solution

  • It looks like you didn't ready FTP Inbound Channel Adapter docs carefully: https://docs.spring.io/spring-integration/reference/html/ftp.html#ftp-inbound

    This one is that type of components which downloads remote files to their local copy. That's why we talk here about a local directory and there is an option on that channel adapter. The point is that this channel adapter downloads remote files into local dir and only after that it builds a message with a local file to send into a channel. You definitely should not interfere with other components to do anything in this local dir. The statement says that if there are some files in that local dir already, they are published as payload first and only then this channel adapter takes a route for fetching remote files.

    You cannon stop this logic, unless you remove those files after processing. Although you can use a Streaming Inbound Channel Adapter instead: https://docs.spring.io/spring-integration/reference/html/ftp.html#ftp-streaming