要求:我們正在嘗試實現一個應用程序,其功能是將文件從入站文件夾移動到使用spring sftp出站網關通過sftp處理文件夾。我們已經實現瞭如下所示的sftp出站網關。當我們執行的應用它給什麼,也就是說,既不例外,也不期望輸出(即文件未動過SFTP)如何使用spring集成SFTP網關將文件移動到文件夾?
<int-sftp:outbound-gateway id="remoteftpLS"
session-factory="defaultSftpSessionFactory" request-channel="sftpRequestChannel"
filename-regex=".*\.txt$" command="mv" expression="'/tmp/datlaa'"
rename-expression="'/tmp/datlaa/archive'" />
我想從「/ tmp目錄/ datlaa移動* .txt文件到/ tmp/datlaa /存檔。
能否請您在我身邊提出任何配置錯誤。或如何使其工作?
感謝
添加應用程序上下文文件 http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integrationhttp://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/sftphttp://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd「>
這不是Spring集成限制,SFTP在重命名命令中不支持通配符。 –
感謝Artem和Gary的迴應。 我們已經通過上述評論,然後嘗試實施實際要求。即從sftp讀取文件,然後通過sftp將相同的文件移動到存檔文件夾。爲此,我們在上下文文件中完成了下面的配置,但仍然沒有移動文件。除了配置文件,我們有一個Java主類,它只加載上下文文件。你可以請建議我們需要改變配置/在Java類中添加任何代碼。 – ragani
Java Class 'public class SftpGatewaySample {0} {0}私有靜態記錄器記錄器= Logger.getLogger(SftpGatewaySample.class); \t公共靜態無效的主要(字串[] args){ \t \t ApplicationContext的上下文= \t \t \t \t新的ClassPathXmlApplicationContext( 「outboundGateway.xml」);」 – ragani