I am trying to read a remote file line by line, using spring integration. Using the spring documentation found here I have set up my project to poll for the file and transfer it via sftp when it is found. I am stuck on how to go about reading the file contents one line at a time.
Here is my inbound channel adapter setup that currently works to pull in files.
<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>
Edit: To clarify, I would like to retrieve one line at a time from the remote file, then process the contents of that line, then retrieve the next line. Similar to creating a java.io.inputstream for a local file and reading it line by line.
Any help is much appreciated. Thank you!