0
我正在嘗試使用彈簧集成逐行讀取遠程文件。使用找到的spring文檔here我已經建立了我的項目來輪詢文件,並在找到時通過sftp傳輸它。我被困在如何去讀一次一行文件內容。彈簧集成 - 逐行讀取遠程文件
這是我的入站通道適配器設置,目前用於拉入文件。
<int-sftp:inbound-channel-adapter id="sftpAdapterAutoCreate"
session-factory="sftpSessionFactory"
channel="receiveChannel"
filename-pattern="*.txt"
remote-directory="/home/springftp"
preserve-timestamp="true"
local-directory="file:C:\sprintftp"
auto-create-local-directory="true"
temporary-file-suffix=".writing"
delete-remote-files="false">
<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
</int-sftp:inbound-channel-adapter>
<int:channel id="receiveChannel">
<int:queue/>
</int:channel>
編輯:爲了澄清,我想從遠程文件一次檢索一行,然後處理該行的內容,然後檢索下一行。類似於爲本地文件創建java.io.inputstream並逐行讀取它。
任何幫助,非常感謝。謝謝!
對不起,我應該澄清我的意圖。我想從遠程文件中一次檢索一行,然後處理該行的內容,然後檢索下一行。類似於爲本地文件創建java.io.inputstream並逐行讀取它。 – Chris 2014-09-19 13:01:33
在此事上增加了示例代碼 – 2014-09-19 13:14:59
@ArtemBilan我們不能使用SFTP出站網關'get'命令和'-stream'選項來將文件讀取爲流? http://docs.spring.io/spring-integration/reference/html/sftp.html#sftp-outbound-gateway – 2016-01-06 06:19:56