在Spring Integration 5上使用Spring Integration Java DSL在入站通道上配置目录扫描程序

问题描述 投票:1回答:1

因此,Spring Integration 5为入站通道引入了目录扫描程序的概念,我很想在我的ftp通道中使用它。

但是我不确定如何使用Java DSL配置它。 docs说我可以在xml中将扫描仪设置在扫描仪入站通道适配器上。但是,我正在使用Spring Integration DSL via IntegrationFlow,看起来我采用这种方法时无法设置此目录扫描程序...

这是真的?有没有办法可以使用IntegrationFlow设置目录扫描程序。我知道我可以采用更正式的Java Config方法,但我不愿意这样做会有很多工作要做。

java spring spring-integration spring-integration-dsl
1个回答
1
投票

看起来我们刚刚错过了向DSL添加scanner选项。

但是,这是一个简单的解决方法:

    FtpInboundFileSynchronizingMessageSource ftpSource =
            Ftp.inboundAdapter(sessionFactory())
                    .regexFilter(".*\\.txt$")
                    .get();
    ftpSource.setScanner(...);
    IntegrationFlow flow = IntegrationFlows.from(ftpSource,

因此,您需要的是从DSL规范中提取目标对象并直接调用其setter。

随意将.scanner()选项贡献给RemoteFileInboundChannelAdapterSpec回到框架!

© www.soinside.com 2019 - 2024. All rights reserved.