我的要求是仅当用户单击GUI中的特定按钮时才从远程sftp服务器中的动态路径下载具有.json扩展名的特定文件,即短文件仅需要在对远程服务器的休息服务调用期间下载 . 远程目录路径将作为参数传递给服务调用 . 我需要使用 spring 集成模块在使用java配置的spring启动项目中执行它 . 我是Spring集成的新手 . 任何人都可以帮助我吗?
对于这种任务,您应该使用带有 Command.GET 的 SftpOutboundGateway .
Command.GET
SftpOutboundGateway
请参阅有关此事的文档:https://docs.spring.io/spring-integration/docs/current/reference/html/sftp.html#_using_the_literal_get_literal_command_2
SftpOutboundGateway 的 expression 选项必须求值为包含文件名的远程路径 . 它可以简单地为 expresion="payload" 或引用任何标头,也可以针对应用程序上下文中的任何其他bean进行评估 .
expression
expresion="payload"
您可以从现有的SFTP样本中获得一些想法:https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp
1 回答
对于这种任务,您应该使用带有
Command.GET
的SftpOutboundGateway
.请参阅有关此事的文档:https://docs.spring.io/spring-integration/docs/current/reference/html/sftp.html#_using_the_literal_get_literal_command_2
SftpOutboundGateway
的expression
选项必须求值为包含文件名的远程路径 . 它可以简单地为expresion="payload"
或引用任何标头,也可以针对应用程序上下文中的任何其他bean进行评估 .您可以从现有的SFTP样本中获得一些想法:https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp