I have successfully set up Spring with SFTP integration, and am polling an SFTP server and pulling down files.
What I would like to know, is it possible for a task to be fired on each file once it's download has completed? I don't want to go down the road of filesystem watches - is there something built into Spring SFTP for this?
Having looked at the documentation, it looks like it can be achieved with Channels.
This is what my receiver channel currently looks like:
It is also important to understand that SFTP Inbound Channel Adapter is a Polling Consumer and therefore you must configure a poller (either a global default or a local sub-element). Once the file has been transferred to a local directory, a Message with java.io.File as its payload type will be generated and sent to the channel identified by the channel attribute.
Looks like you have to start from the beginning of Enterprise Integration Patterns and determine for yourself that
channel is the most important first class citizen in the integration.
So, you have an
<int-sftp:inbound-channel-adapter>, which responsibility to poll entities from the remote directory, turn them to the
java.io.File (like you noticed in the RTFM) and send as a
Message to the configured channel. The subscriber for that channel will pick up the message and do some desired process under that
See also Spring Integration Samples for more information.