2017-02-02 37 views
1

我在SFTP站適配器如何根據文件名中的SFTP適配器Spring集成

<int-sftp:inbound-channel-adapter id="sftpInbondAdapter" 
             channel="sftpInboundChannel" 
             session-factory="sftpSessionFactory" 
             filename-pattern="*.DONE" 
             remote-directory="/C:/Users/Desktop"          
             local-directory="D:\Documents1" 
             auto-create-local-directory="false" 
             local-filename-generator-expression="#this" 
             delete-remote-files="false" > 
     <int:poller fixed-rate="1000" task-executor="executor"/> 
    </int-sftp:inbound-channel-adapter> 

以下配置爲傳入文件的動態本地目錄我要爲傳入文件取決於動態的本地目錄文件名。像test123.Done是文件名,那麼我必須將該文件放在我的本地目錄D:\ Documents1 \ test123 \ test123.Done中。 那麼如何在我的sftp中爲入站適配器生成local-directory =「」的動態路徑?

+0

分享你的代碼你試過的東西 –

回答

1

您無法使用該入站適配器。

您可以使用outbound gateways來做到這一點;使用其中一個獲取遠程目錄的列表(ls),第二個獲取(get)每個文件 - 它需要一個本地目錄表達式和一個本地文件名生成器表達式。

The SFTP sample uses gateways to list, get, and remove remote files

+0

我得到了你的答案@Gary,它在實施時正常工作。 – inj3ct0r

+0

@ inj3ct0r你可以分享樣品,我卡在這裏 – Hikmat

相關問題