具有 Spring 集成流的多个过滤器表达式

Multiple Filter Expression with Spring Integration Flow

我正在使用 spring 集成流程并且我知道如何添加过滤器表达式

IntegrationFlows.from(Sftp.inboundAdapter(inboundSftp)
            .localDirectory(this.getlocalDirectory(config.getId()))
            .deleteRemoteFiles(true)
            .filterExpression(config.getFilterExpression())
            .autoCreateLocalDirectory(true)
            .remoteDirectory(config.getInboundDirectory()), e -> e.poller(Pollers.cron(config.getCron()).errorChannel(MessageHeaders.ERROR_CHANNEL).errorHandler((ex) -> {
           // action on exceptions are here
        }))).publishSubscribeChannel(s -> s
            .subscribe(f -> f
                .handle(Sftp.outboundAdapter(outboundSftp)
                        .useTemporaryFileName(false)
                        .autoCreateDirectory(true)
                        .remoteDirectory(config.getOutboundDirectory()), c -> c.advice(startup.deleteFileAdvice())
                ))
            .subscribe(f -> f
                .handle(m -> {
                    // all my custom logging logic is here
                })
            ))
            .get();

我想了解的。

您可以改用 .regexFilter

".*\.(xml|csv)"

.filterExpression("name.endsWith('.csv') OR name.endsWith('xml')")

.filterExpression("!name.endsWith('.txt')")