Spring SFTP Integration is not polling the file

∥☆過路亽.° 提交于 2021-01-29 08:32:42

问题


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>

回答1:


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.



来源:https://stackoverflow.com/questions/62781759/spring-sftp-integration-is-not-polling-the-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!