【问题标题】:Spring inbound file channel adapter prevent-duplicates=false not workingSpring 入站文件通道适配器 prevent-duplicates=false 不起作用
【发布时间】:2017-08-28 06:25:43
【问题描述】:

我遇到了 spring 入站通道适配器的问题。导入新文件效果很好。但是选项 prevent-duplicates="false" 似乎无法正常工作 - 当同名文件保存到指定目录时,它不会被导入。

入站通道适配器的定义:

  <int-file:inbound-channel-adapter id="incidentExportAdapter"
    directory="file:${incident.export.directory.path}" prevent-duplicates="false"
    channel="incidentExportChannel" filename-regex="GA[0-9]{6}.(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-7])$" auto-create-directory="true" 
    auto-startup="false" >
    <int:poller default="true" fixed-delay="${incident.export.interaction.polltime}" id="poller" time-unit="MILLISECONDS" max-messages-per-poll="5"></int:poller>

  </int-file:inbound-channel-adapter>

提前感谢您的任何建议! 如果我能得到一些可行的例子就好了,因为我尝试了很多但到目前为止没有成功。

【问题讨论】:

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


    【解决方案1】:

    默认AcceptOnceFileListFilter不看lastModified文件属性,只看文件名,可能需要FileSystemPersistentAcceptOnceFileListFilter

    请参阅documentation

    【讨论】:

    • prevent-duplicates="false" 配置 AcceptAllFileListFilter 而不是 AcceptOnceFileListFilter 所以这不是问题。我建议打开 DEBUG 日志记录。
    猜你喜欢
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 2014-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-08
    相关资源
    最近更新 更多