Red Hat Camel K is deprecated
Red Hat Camel K is deprecated and the End of Life date for this product is June 30, 2025. For help migrating to the current go-to solution, Red Hat build of Apache Camel, see the Migration Guide.3.3. 在 YAML 中开发 Camel K 集成
本节介绍如何在 YAML DSL 中开发简单的 Camel K 集成。使用 Camel K 在 YAML 中编写集成与在 Camel 中定义路由规则相同。
您可以直接在集成路由中使用任何 Camel 组件。Camel K 自动处理依赖关系管理,并使用代码检查从 Camel 目录导入所有需要的库。
前提条件
流程
输入
kamel init
命令以生成简单的 YAML 集成文件。例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow kamel init hello.camelk.yaml
$ kamel init hello.camelk.yaml
打开 IDE 中生成的集成文件,并根据情况进行编辑。例如,
hello.camelk.yaml
集成自动包括 Camel计时器
和日志
组件,以帮助您开始:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Write your routes here, for example:
# Write your routes here, for example: - from: uri: "timer:yaml" parameters: period: "1s" steps: - set-body: constant: "Hello Camel K from yaml" - to: "log:info"