我必须在我的应用程序中集成 Spring SFTP.这个想法是侦听 SFTP 路径,如果在 SFTP 中删除了任何文件,则读取该文件并更新数据库表.但我认为 Spring SFTP 入站是在系统之间传输文件.我找不到一个很好的例子来说明如何实现这一点.下面是我正在尝试的配置,但即使我放置了这个 xml 配置,也没有发生任何事情.我需要 XML 配置中的所有内容.有人可以给我一个关于如何实现该目标的示例,或者我如何修改我的配置以实现相同目标.
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> 推荐答案官方 repo 中有这个示例:github/spring-projects/spring-integration-samples/tree/master/basic/sftp
There is this sample in the official repo: github/spring-projects/spring-integration-samples/tree/master/basic/sftp
您确实应该确保将带有 .txt 扩展名的文件放在远程 /tmp/charge/ 中.
You really should be sure that you place there in the remote /tmp/charge/ the file with a .txt extension.
您可能还需要为 org.springframework.integration 开启 DEBUG 日志记录级别,以真正确定您的应用程序中发生了什么.
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.
更多推荐
Spring SFTP 集成不轮询文件
发布评论