I am trying to download a couple of text files from a remote server via SFTP using a java program. For this I am using Spring Integration SFTP module and I have configured an Inbound Channel Adapter as below.
<int:channel id="recieveChannel">
<int:queue />
</int:channel>
<int-sftp:inbound-channel-adapter
session-factory="sftpSessionFactory"
local-directory="C:\test-outbound\"
channel="recieveChannel"
filename-regex=".*\.txt$"
remote-directory="/opt/IInsurer/messages/"
>
<int:poller fixed-rate="10000" receive-timeout="10000"></int:poller>
</int-sftp:inbound-channel-adapter>
The problem is that every thing is working fine i.e. the files are downloaded correctly to the local directory but the pooling keeps on going.I just want this to be a one time thing.I don't want to continuously poll the remote directory.How can I make the polling stop once the files are download?.Basically what I need is some sort of an event driven download mechanism which I manually trigger and once it downloads the files it shuts down.
I have also spring out bound gateway adapter but it does the same.I will really appreciate your help.Many Thanks