Reputation: 902
I am able to copy the file from remote machine to local but not able to move the file to processed folder in remote server.
<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" />
I am not able to move the file to processed folder in remote ftp
Upvotes: 0
Views: 3087
Reputation: 1021
I agree with Gary Russell that the best way would be to use mv
command. But if you want to use current release, you can try configuration similar to this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:sftp="http://www.springframework.org/schema/integration/sftp"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/sftp
http://www.springframework.org/schema/integration/sftp/spring-integration-sftp-2.2.xsd">
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="localhost"/>
<property name="user" value="user01"/>
<property name="password" value="abc123"/>
<property name="port" value="990"/>
</bean>
<int:channel id="sftpChannel"/>
<sftp:inbound-channel-adapter local-directory="/tmp/test" filename-pattern="*.xml"
channel="sftpChannel" session-factory="sftpSessionFactory"
remote-directory="/">
<int:poller fixed-rate="5000"/>
</sftp:inbound-channel-adapter>
<sftp:outbound-channel-adapter channel="sftpChannel" session-factory="sftpSessionFactory"
remote-directory="/processed"/>
</beans>
inbound-channel-adapter
downloads the file from SFTP server to a local directory and outbound-channel-adapter
places copy of that file in /processed folder on SFTP server.
Note that this is definitely not the best option, since you have to reupload your file to SFTP.
Upvotes: 1
Reputation: 174484
If you need to rename a file on the remote machine, the upcoming 3.0 release now has a mv
command on the (s)ftp outbound gateway.
Upvotes: 1
Reputation: 677
Please go through this link:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac55462_.htm may be help to move file on remote server...
Upvotes: 0