路由骆驼 cron 表达式

Route camel cron expression

我想在我的骆驼路线中加入一个每天 8 点开始的调度程序。 这是我从 ftp:

获取文件的路线
from(
            "$uri?" +
                    "password=RAW($pass)" +
                    "&include=$source_file_type" +
                    "&passiveMode=true" +
                    "&delete=true"
        )
            .log("Connected to FTP")

我试着把我的从这个:

"&scheduler.cron=$cron_expression"

但是没用

为 FTP 组件的 scheduler 属性 引用 docs

To use a cron scheduler from either camel-spring or camel-quartz component. The value can be one of: none, spring, quartz

要使用 cron 样式表达式,您需要将 FTP 与文档中提到的两个调度程序选项之一结合使用。

要在 Camel 3.x 中使用石英作为调度器,试试这个

  1. 添加对 camel-quartz 的依赖
  2. 将参数 scheduler=quartz&scheduler.cron=<your crown expression> 添加到 FTP 路由定义

如果您使用的是 Camel 2.x,

  1. 添加对 camel-quartz2 的依赖
  2. 将参数 scheduler=quartz2&scheduler.cron=<your crown expression> 添加到 FTP 路由定义