我正在使用Spring integration的SFTP与出站通道适配器将文件上传到远程位置。当它将文件发送到一个SFTP位置时,它可以正常工作。但是,在我的代码中,我试图根据不同的标准发送到多个SFTP位置。
以下是我的设置-以下来自Spring integration文档
<beans:bean id="sftpSessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<beans:property name="host" value="localhost"/>
<beans:property name="password" value="password"/>
<beans:property name="port" value="22"/>
<beans:property name="user" value="user"/>
</beans:bean>
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
session-factory="sftpSessionFactory"
channel="outputChannel"
remote-directory="foo/bar"
use-temporary-filename="false"
mode="REPLACE"/>
我的问题是:
- 有没有人知道如何配置多个SFTP会话
- 对于出站通道适配器,是否有任何方法可以在我的代码中设置它而不是XML,特别是我想计算remote-directory的值。
谢谢
请参阅动态ftp样例应用程序,了解实现所需功能的技术。
即将发布的4.2版本(候选版本1现在可用)有一个DelegatingSessionFactory
,您可以在其中动态查找要使用的会话工厂。