Spring SFTP 集成未轮询文件

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>

官方仓库中有这个示例:https://github.com/spring-projects/spring-integration-samples/tree/master/basic/sftp

您真的应该确保将扩展名为 .txt 的文件放在远程 /tmp/charge/ 中。

您可能还需要为 org.springframework.integration 打开 DEBUG 日志记录级别,以真正确定您的应用程序中发生了什么。