使用int-sftp:inbound-channel-adapter时重新读取文件

时间:2017-04-27 14:00:03

标签: java spring-integration spring-integration-sftp

我有一个int-sftp:inbound-channel-adapter,它使用SftpPersistentAcceptOnceFileListFilter作为复合过滤器的一部分。阅读文档/源代码,如果修改后的日期时间发生了变化,它应该接受再次读取的文件,但我不能让它工作,它只读取一次。我使用redis作为商店。

任何想法配置有什么问题,我使用spring integration 4.3.5

<int-sftp:inbound-channel-adapter id="sftpInboundAdapterCensus"
    channel="sftpInboundCensus"
    session-factory="sftpSessionFactory"
    local-directory="${sftp.localdirectory}/census-local"
    filter="censusCompositeFilter"
    remote-file-separator="/"
    remote-directory="${sftp.directory.census}">
    <int:poller cron="${sftp.cron}" max-messages-per-poll="1" error-channel="pollerErrorChannel"/>
</int-sftp:inbound-channel-adapter>

<bean id="censusCompositeFilter"
class="org.springframework.integration.file.filters.CompositeFileListFilter">
<constructor-arg>
 <list>
     <bean class="org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter">
         <constructor-arg value="*.xml" />
     </bean>
     <bean id="SftpPersistentAcceptOnceFileListFilter" class="org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter">
         <constructor-arg ref="metadataStore" />
         <constructor-arg value="censusSampleLock_" />
     </bean>
 </list>
</constructor-arg>
</bean>

1 个答案:

答案 0 :(得分:0)

SftpPersistentAcceptOnceFileListFilter仅控制我们从服务器获取的内容。您还需要FileSystemPersistentAcceptOnceFileListFilter中的local-filter(它确定哪些文件最终被作为消息发出)。默认情况下,本地过滤器为AcceptOnceFileListFilter