VKP
VKP

Reputation: 658

Spring SFTP Integration is not polling the file

I have to integrate Spring SFTP in my application . The idea is to listen to a SFTP path and if any file is dropped in SFTP , read the file and update the DB tables . But i think Spring SFTP inbound is to transfer the files between systems . I could not find a good example on how to achieve that . below is the configuration i am trying , but nothing is happening even after i place this xml configuration . I need everything in XML configuration. Can someone suggest me a example on how to achieve that or how i can modify my configuration to achieve the same.

<bean id="sftpSessionFactory" 
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
    <property name="host" value="hostname"/>
    <property name="port" value="22"/>
    <property name="user" value="vkp"/>
    <property name="password" value="1234"/>
</bean>
<int-sftp:inbound-channel-adapter id="sftpAdapterAutoCreate"
                                  session-factory="sftpSessionFactory"
                                  channel="requestChannel"
                                  filename-pattern="*.txt"
                                  remote-directory="/tmp/charge/"
                                  local-directory="file:target/charge"
                                  auto-create-local-directory="true"
                                  local-filename-generator-expression="#this.toUpperCase() + '.a'"
                                  delete-remote-files="false">
    <int:poller fixed-rate="1000"/>
</int-sftp:inbound-channel-adapter>

Upvotes: 0

Views: 1096

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121550

There is this sample in the official repo: https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp

You really should be sure that you place there in the remote /tmp/charge/ the file with a .txt extension.

You probably also need to turn on DEBUG logging level for the org.springframework.integration to be really sure what is going on in your application.

Upvotes: 1

Related Questions