I manage to transfer file from local to remote ftp. Now, I want the list of paths and files that was involved so that I may apply logic on it like inserting new rows into the database. It was said that
The message payload resulting from an mput operation is a List object (that is, a List of remote file paths resulting from the transfer).
which I get from here
Here is my code, in which credited to Gary Russell for providing answer from my previous question
@Bean(value = "localToFtp")
public IntegrationFlow fileToFile() {
IntegrationFlow flow = IntegrationFlows
.fromSupplier(() -> "/local",
e -> e.poller(Pollers.fixedDelay(Duration.ofSeconds(5))))
.handle(Sftp.outboundGateway(awasDelegatingSessionFactory(),
AbstractRemoteFileOutboundGateway.Command.MPUT,
null)
.autoCreateDirectory(true)
.options(AbstractRemoteFileOutboundGateway.Option.RECURSIVE)
.remoteDirectoryExpression(REMOTE_DIR))
.channel("nullChannel")
.get();
return flow;
}
Thanks in advance.
CodePudding user response:
You are discarding the list of file names returned by the gateway, by sending it to nullChannel
.
Add another .handle()
method there - the message payload is the list of remote paths.