【问题标题】:SFTP Persistent Accept Only Once filter on sftp gatewaySFTP Persistent Accept Only Once 在 sftp 网关上过滤
【发布时间】:2017-09-20 08:08:53
【问题描述】:

我有这段代码,我想在其中合并一个 SftpPersistentAcceptOnceFileListFilter,但我不知道如何。过滤器应该在本地检索文件之前。

@InboundChannelAdapter(value = "sftpMgetInputChannel",
    poller = @Poller(fixedDelay = "5000"))
public String filesForMGET(){
  return "'/tmp/input/remoteDirectory/*'";
}

@Bean
public IntegrationFlow sftpMGetFlow() {
    return IntegrationFlows.from("sftpMgetInputChannel")
            .handleWithAdapter(h -> h.sftpGateway(this.sftpSessionFactory,
             Command.MGET, "payload")
            .options(Option.RECURSIVE)
            .regexFileNameFilter("((\\d{8})|*\\.txt)")
            .localDirectoryExpression("'sftp-inbound/'" + "#remoteDirectory"))
            .handler(messageHandler())
            .get();
}

@Bean
public MessageChannel sftpMgetInboundChannel(){
   return new DirectChannel();
}

@Bean
public MessageHandler messageHandler(){
 return new MessageHandler() { ... }
}

【问题讨论】:

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


    【解决方案1】:

    CompositeFileListFilterChainFileListFilterSftpRegexPatternFileListFilter 过滤器和SftpPersistentAcceptOnceFileListFilter 一起使用。

    构造过滤器并使用.filter(compositeFilter())

    【讨论】:

    • 过滤器中的前缀ctor arg只是为了允许在多个过滤器中使用同一个存储,用于隔离。
    猜你喜欢
    • 1970-01-01
    • 2017-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多