According to http://docs.spring.io/spring-integration/reference/html/ftp.html#ftp-outbound-gateway the mget payload is a List of files
mget retrieves multiple remote files based on a pattern and supports the following option:
...
The message payload resulting from an mget operation is a ListFile> object - a List of File objects, each representing a retrieved file.
I have the following configuration
<int-ftp:outbound-gateway
session-factory="ftpSesionFactory"
request-channel="request-channel"
reply-channel="reply-channel"
auto-create-directory="true"
local-directory="${local-directory}"
command="mget"
command-options="-stream"
expression="payload">
<int-ftp:request-handler-advice-chain>
<int:retry-advice />
</int-ftp:request-handler-advice-chain>
</int-ftp:outbound-gateway>
<int-file:splitter input-channel="reply-channel" output-channel="logger"/>
But the payload is a List<FTPFile> and the splitter doesn't work. Is this a bug? How can I obtain the downloaded Listjava.io.File> in the payload (as the documentation says)?.
The workaround is using another component to read the file from the local directory, described at how to get file with int-ftp:outbound-gateway and remove from server if exists?.
I'm using spring-integration 4.2.5 and commons-net-2.0.
What makes you believe it's List<FTPFile
?
This test shows it's a List<java.io.File>
.
The ls
command returns either a list of String
or FTPFile
, depending on the -1
option.
Finally, -stream
is not supported on mget
, only get
.
Also, you don't want a file splitter there - that reads each file - you need a regular <int:splitter/>
to split the List<File>
into separate files; then the file splitter will read the file lines.