【问题标题】:Spring integration DSL example of file polling inbound channel adapterSpring集成DSL文件轮询入站通道适配器示例
【发布时间】:2015-07-08 15:46:20
【问题描述】:

在任何地方都找不到使用 spring 集成 DSL only xml 的示例。任何指针表示赞赏,还需要轮询器在文件创建和修改时触发

【问题讨论】:

    标签: spring-integration spring-dsl


    【解决方案1】:

    这个怎么样:

    @Bean
    public IntegrationFlow fileReadingFlow() {
        return IntegrationFlows
                .from(s -> s.file(tmpDir.getRoot()).patternFilter("*.sitest"),
                        e -> e.poller(Pollers.fixedDelay(100)))
                .transform(Transformers.fileToString())
                .channel(MessageChannels.queue("fileReadingResultChannel"))
                .get();
    }
    

    .from() 工厂方法在这里接受 MessageSources 工厂,您正在使用 .file() 工厂方法等等。

    更多信息在项目测试中:https://github.com/spring-projects/spring-integration-java-dsl/tree/master/src/test/java/org/springframework/integration/dsl/test

    【讨论】:

    • 感谢 Artem,但这个轮询器会在文件创建/修改时触发吗?我的原创。溶胶。正在使用 Java nio lib 来实现这一点。
    猜你喜欢
    • 1970-01-01
    • 2018-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-11
    • 1970-01-01
    • 2014-12-07
    • 2023-03-21
    相关资源
    最近更新 更多