第 22 章 cron
仅支持消费者
Cron 组件是一个通用接口组件,它允许以特定时间间隔触发事件,使用 Unix cron 语法(如 0/2 * ? )来每两秒触发事件。
是一个接口组件,Cron 组件不包含默认的实现,而是要求用户插件自己选择的实现。
以下标准 Camel 组件支持 Cron 端点:
- Camel-quartz
- camel-spring
Camel K 中也支持 Cron 组件,该组件可以使用 Kubernetes 调度程序在 cron 表达式需要时触发路由。当使用与 Kubernetes cron 语法兼容的 cron 表达式时,Camel K 不需要插入额外的库。
22.1. 依赖项 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
当在 Red Hat build of Camel Spring Boot 中使用 cron 时,请确保使用以下 Maven 依赖项来支持自动配置:
<dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-cron-starter</artifactId> </dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-cron-starter</artifactId>
</dependency>
为了插入特定实施,可能需要其他库。