繁体   English   中英

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

[英]Configure a directory scanner on an inbound channel with Spring Integration Java DSL on Spring Integration 5

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

但是我不确定如何使用 Java DSL 配置它。 文档说我可以在 xml 中的扫描仪入站通道适配器上设置扫描仪。 但是,我正在通过 IntegrationFlow使用Spring Integration DSL,并且在采用这种方法时,我似乎无法设置此目录扫描程序...

这是真的? 有没有办法可以使用 IntegrationFlow 设置目录扫描程序。 我知道我可以转而使用更正式的 Java Config 方法,但我不希望这样做,因为那将是很多工作。

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

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

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

所以,你需要的是从 DSL Spec 中提取一个目标对象并直接调用它的 setter。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM