简体   繁体   English

路由骆驼cron表达式

[英]Route camel cron expression

I would like to include a scheduler in my camel route that will start it every day at 8. This is my route that takes a file from an ftp:我想在我的骆驼路线中包含一个调度程序,它将每天在 8 点启动它。这是我从 ftp 获取文件的路线:

from(
            "$uri?" +
                    "password=RAW($pass)" +
                    "&include=$source_file_type" +
                    "&passiveMode=true" +
                    "&delete=true"
        )
            .log("Connected to FTP")

I tried to put in my from this:我试图从这个输入我的:

"&scheduler.cron=$cron_expression"

but it did not work但它没有用

Quoting the docs for scheduler property of FTP Component.引用 FTP 组件scheduler属性的 文档

To use a cron scheduler from either camel-spring or camel-quartz component.使用来自camel-spring 或camel-quartz 组件的cron 调度程序。 The value can be one of: none, spring, quartz该值可以是以下之一:none、spring、quartz

To use a cron style expression, you need to couple FTP with one of the two scheduler options mentioned in the docs.要使用 cron 样式表达式,您需要将 FTP 与文档中提到的两个调度程序选项之一结合使用。

For using quartz as a scheduler in Camel 3.x, try this要在 Camel 3.x 中使用石英作为调度程序,试试这个

  1. Add dependency to camel-quartz添加对骆驼石英的依赖
  2. Add params scheduler=quartz&scheduler.cron=<your crown expression> to FTP route definition将参数scheduler=quartz&scheduler.cron=<your crown expression>到 FTP 路由定义

If you are using Camel 2.x,如果您使用的是 Camel 2.x,

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

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

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