sftp 网关上的 SFTP 持久只接受一次过滤器
SFTP Persistent Accept Only Once filter on sftp gateway
我有这段代码,我想在其中加入 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() { ... }
}
使用 CompositeFileListFilter
或 ChainFileListFilter
与 SftpRegexPatternFileListFilter
过滤器和 SftpPersistentAcceptOnceFileListFilter
.
构造过滤器并使用.filter(compositeFilter())
。
我有这段代码,我想在其中加入 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() { ... }
}
使用 CompositeFileListFilter
或 ChainFileListFilter
与 SftpRegexPatternFileListFilter
过滤器和 SftpPersistentAcceptOnceFileListFilter
.
构造过滤器并使用.filter(compositeFilter())
。