[英]Spring SFTP Integration is not polling the file
我必须在我的应用程序中集成 Spring SFTP。 这个想法是监听 SFTP 路径,如果有任何文件被丢弃在 SFTP 中,则读取文件并更新数据库表。 但我认为 Spring SFTP 入站是在系统之间传输文件。 我找不到如何实现这一目标的好例子。 下面是我正在尝试的配置,但即使在我放置此 xml 配置后也没有发生任何事情。 我需要 XML 配置中的所有内容。 有人可以建议我一个关于如何实现这一目标的例子,或者我如何修改我的配置以实现同样的目标。
<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 中有这个示例: https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp
您确实应该确保将扩展名为.txt
的文件放在远程/tmp/charge/
中。
您可能还需要为org.springframework.integration
打开DEBUG
日志记录级别,以真正确定您的应用程序中发生了什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.