0

I want to add the temporary prefix or suffix while streaming the file from a remote directory using SFTP.

I have tried to add temporaryFileSuffix to outboundGateway while streaming the file but it is not adding any suffix later I checked it is documented that "Set the temporary suffix to use when transferring files to the remote system."

.handle(Sftp.outboundGateway(sftpSessionFactory(), GET, "payload.remoteDirectory + payload.filename").options(STREAM).temporaryFileSuffix("_reading"))

Do I need to Rename the file using Rename gateway or there is a better way to do it.

David
  • 507
  • 2
  • 6
  • 14

1 Answers1

0

Your question is not clear - do you mean you want to copy it with a temporary name locally? Or, do you mean you want to rename it on the remote server before copying?

If the former, use the localFilenameGeneratorExpression.

If the latter, you would have to use the MV gateway first.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • My question is that **while** I am streaming the file from the remote directory I want some prefix or suffix to be added in the fileName so that other person knows that this file is getting read. – David Jun 06 '19 at 21:48
  • There is currently no mechanism to rename a remote file while it is being fetched. Seems like a reasonable suggestion. Feel free to open an issue in GitHub. – Gary Russell Jun 06 '19 at 22:32
  • Raised an enhancement https://github.com/spring-projects/spring-integration/issues/2955 in GitHub for the same – David Jun 07 '19 at 00:02