2017-06-30 45 views
1

我試圖通過FTP發送文件從本地目錄到遠程目錄, ,並且能夠成功發送文件,但是另外文件被FTP'ed到本地目錄,因爲ftpInbound也建立了一個FTP連接,我不希望我的應用程序這樣做。如果我刪除了入站FTP通道適配器,則無法將本地目錄路徑也提供給ftpOutbound。還有其他方法可以解決這個問題嗎?發送文件到遠程目錄的彈簧集成

<int-ftp:inbound-channel-adapter id="ftpInbound" 
           channel="ftpChannel" 
           session-factory="ftpClientFactory" 
           filename-pattern="*.txt" 
           local-directory="$dina-communication.batch-{localDirectory}" 
           temporary-file-suffix=".writing"> 
<int:poller fixed-rate="10000" /> 

</int-ftp:inbound-channel-adapter> 

<int-ftp:outbound-channel-adapter id="ftpOutbound" 
           channel="ftpChannel" 
           session-factory="ftpClientFactory" 
           remote-directory="$dina-communication.batch-{Remote_directory}" 
           temporary-file-suffix=".writing"> 
</int-ftp:outbound-channel-adapter> 

回答

1

如果你談論餵養本地目錄內容的FTP服務器,你應該考慮真正<int-file:inbound-channel-adapter>使用:http://docs.spring.io/spring-integration/reference/html/files.html#file-reading

還有對此事的樣本:https://github.com/spring-projects/spring-integration-samples/tree/master/basic/file

你應該用<int-file:inbound-channel-adapter>代替你的<int-ftp:inbound-channel-adapter>

+0

columnNumber:43;元素「int-file:inbound-channel-adapter」的前綴「int-file」未被綁定。 \t at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)---我得到上述錯誤,int-file不能與int-ftp匹配,因爲我的出站目錄是遠程服務器。它也可以用於遠程服務器嗎? – DinaMike

+0

你應該在你的classpath中有'spring-integration-file'並且有一個合適的XSD定義。您可以在提供的示例中找到:http://www.springframework.org/schema/integration/file \t \t \t http://www.springframework.org/schema/integration/file/spring-integration-file .xsd' –