【问题标题】:File Poller implementation in Spring Boot-Camel ApplicationSpring Boot-Camel 应用程序中的文件轮询器实现
【发布时间】:2018-06-20 18:02:41
【问题描述】:

我是 Apache Camel 框架的新手。我必须在 Spring Boot 和 Camel 中开发一个应用程序,它反复轮询给定的目录(即使在目录经过任何修改之后,轮询器也应该继续轮询另一个预定的时间间隔,依此类推。 我在骆驼中发现了类似下面的代码。

公共类 FilePoller 扩展 RouteBuilder {

@Override
public void configure() {
    from("file:H:\\InputFolder?delay=1000&noop=true")
    .process(new Processor() {
        public void process(Exchange msg) {
            File file = msg.getIn().getBody(File.class);
            //LOG.info("Processing file: " + file);
            System.out.println("Polling file:"+file);

        }

}); 
}

}

上面的代码只等待1秒,然后不轮询目录就执行后面的代码。

任何人都可以帮助我开发一个 Spring Boot-Camel 应用程序,该应用程序在每个给定的时间间隔重复轮询目录或文件。在此先感谢

【问题讨论】:

    标签: file spring-boot apache-camel poller


    【解决方案1】:

    请参阅此骆驼文件组件文档。

    https://github.com/apache/camel/blob/master/camel-core/src/main/docs/file-component.adoc

    要与 Spring boot 集成,您需要使用 SB 版本

    【讨论】:

      猜你喜欢
      • 2019-05-10
      • 2020-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-15
      • 2017-01-19
      • 2022-11-03
      • 1970-01-01
      相关资源
      最近更新 更多