【发布时间】:2014-11-14 01:40:10
【问题描述】:
我正在尝试使用 spring 集成逐行读取远程文件。使用找到here 的spring 文档,我已经将我的项目设置为轮询文件并在找到时通过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 spring spring-integration