【发布时间】:2013-10-01 02:26:31
【问题描述】:
我可以将文件从远程机器复制到本地,但无法将文件移动到远程服务器中的已处理文件夹。
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="test.com"/>
<property name="user" value="test"/>
<property name="password" value="test123"/>
<property name="port" value="22"/>
</bean>
<int:publish-subscribe-channel id="publishToSFTPChannel" />
<sftp:inbound-channel-adapter local-directory="#{articlesLocalDirectory}" filename-pattern="*.xml" channel="publishToSFTPChannel" session-factory="sftpSessionFactory" remote-directory="#{articlesRemoteDirectory}">
<int:poller fixed-rate="12000"/>
</sftp:inbound-channel-adapter>
<file:outbound-channel-adapter id="moveProcessedFile"
session-factory="sftpSessionFactory"
channel="publishToSFTPChannel"
directory="#{articlesRemoteDirectory}/processed"
delete-source-files="true" />
我无法将文件移动到远程 ftp 中的已处理文件夹
【问题讨论】:
-
你想达到什么目的?您想将文件从 SFTP 服务器下载到本地目录,然后将相同的文件移动到同一 SFTP 服务器上的另一个目录?您的配置不适用于此。您有文件出站适配器,它只会将文件复制到本地目录,而不是远程目录,并且您不需要
session-factory。请准确描述您要做什么,因为您在问题中陈述的内容和我在配置中看到的内容是不同的。 -
@Dmitry 再次感谢。我想要实现的是我想将文件从 FTP 复制到本地目录。复制该文件后,我需要将 FTP 中的文件移动到同一远程目录中的已处理文件夹。
标签: spring sftp spring-integration