【问题标题】:Scheduling using Camel - Quartz2 and Spring boot使用 Camel - Quartz2 和 Spring boot 进行调度
【发布时间】:2018-02-10 15:39:44
【问题描述】:

我正在尝试使用 Camel 和 Quartz2 设置调度程序,我的目标是仅在特定时间段内从队列中读取消息。我在服务器启动时收到以下错误。

org.apache.camel.spring.boot.CamelSpringBootInitializationException: org.apache.camel.FailedToCreateRouteException:创建路由失败 路线1: Route(route1)[[From[quartz2://simpleTimer?cron=0/1+0+13-15+?... 因为无法解析端点: quartz2://simpleTimer?cron=0%2F1+0+13-15+%3F++*+MON-FRI 由于:否 使用方案找到的组件:quartz2

这是 pom 条目

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-quartz2</artifactId>
        <version>2.19.2</version>
        <scope>test</scope>
   </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring-boot-dependencies</artifactId>
        <version>2.19.2</version>
    </dependency>

在路由中编码 sn-p

 from("quartz2://simpleTimer?cron=0/1+0+13-14+?+*+MON-FRI")
        .log("Reading msgs")
        .from("some queue")
        .bean("myBean")

这个也试过了

from("quartz2://testGroup/someName?cron=0/1+0+13-14+?+*+MON-FRI").

我多次尝试解决这个问题,但都失败了,谁能帮我解决这个问题? 我可以将 simpleTimer 与 Cron 设置一起使用,还是有其他方法? 在这方面的任何建议/帮助将不胜感激。

【问题讨论】:

    标签: spring-boot apache-camel quartz-scheduler


    【解决方案1】:

    错误提示你没有在camel-quartz2组件中添加maven中的依赖。

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-quartz2</artifactId>
        <version>x.x.x</version>
        <!-- use the same version as your Camel core version -->
    </dependency>
    

    【讨论】:

      【解决方案2】:

      问题是你把 2 from 放在同一条路线上。每条路线只有一个来自

      当您从队列中读取数据时,例如使用 jms 组件,您会在消息到达时直接获得消息。所以不需要石英组件。

      您使用哪个组件从队列中读取数据?可能这个组件有更多的选项可以帮助你!

      【讨论】:

        【解决方案3】:

        当我在路由文件中创建 QuartzComponent 的 Bean 实例时,这个问题得到了解决。此外,我们可以在路由定义中拥有多个“来自”。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-03-13
          • 1970-01-01
          相关资源
          最近更新 更多