Spring SFTP 集成不轮询文件

编程入门 行业动态 更新时间:2024-10-27 19:28:57
本文介绍了Spring SFTP 集成不轮询文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我必须在我的应用程序中集成 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 集成不轮询文件

本文发布于:2023-08-01 20:11:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271333.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   Spring   SFTP   不轮询

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!