# Apache Camel

**Apache Camel** 是一个开源集成框架，由 Apache 软件基金会维护，基于企业集成模式目录<sup>[1](https://camel.apache.org/manual/)</sup>，让开发者用 Java、XML、Groovy 和 YAML 中的领域特定语言来定义系统间的路由与中介规则。开发者描述应该发生什么——例如从 Kafka 读取、转换数据、写入数据库——Camel 负责处理协议、格式和错误处理<sup>[2](https://camel.apache.org//what-is-apache-camel/)</sup>。该项目于 2007 年 3 月 19 日首次提交，此后已发展到来自 1,500 多名贡献者的超过 100,000 次提交，并根据统计方法不同，提供约 311 到 350 个集成组件<sup>[3](https://camel.apache.org//blog/2026/06/camel-by-the-numbers/)</sup><sup> • </sup><sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 首次提交 | 2007 年 3 月 19 日，由 James Strachan 提交：`camel-core` 和 `camel-jms` 中共 42 个文件<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup> |
| 首个版本 | 根据 Maven Central 时间戳，Camel 1.0 于 2007 年 7 月 2 日发布<sup>[5](https://cwiki.apache.org/confluence/spaces/CAMEL/blog/2011/07/07/27821263/Happy%2BBirthday%2BCamel)</sup> |
| Apache 状态 | 最初作为 Apache ActiveMQ 的子项目构思；2009 年 1 月成为顶级项目<sup>[6](https://camel.apache.org//camel-dna/)</sup><sup> • </sup><sup>[7](https://cwiki.apache.org/confluence/download/export/pdfexport-20260430-300426-1136-719493/Happy%2B5%2Byears%2Bbirthday%2BApache%2BCa_6ec7d74a5940425fbebcd2031954fdee-300426-1136-719494.pdf?contentType=application%2Fpdf)</sup> |
| 规模（2026 年） | 100,000+ 次提交，来自 450+ 家公司的 1,500+ 名贡献者，311 个组件，300+ 个版本<sup>[3](https://camel.apache.org//blog/2026/06/camel-by-the-numbers/)</sup> |
| 核心模型 | 路由通过 Consumer 从端点消费消息，将每条消息包装在 Exchange 中，使其经过 Processor 链，再通过 Producer 投递<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup> |
| 路由形态 | 恰好一个输入端点，以及 0 个、1 个或多个输出端点<sup>[8](https://camel.apache.org/manual/architecture.html)</sup> |
| 当前版本 | 4.18.x LTS、4.22.x LTS 和 4.23.0，支持 Java 17、21 和 25<sup>[9](https://camel.apache.org/download/)</sup> |

## 历史

Camel 诞生于 Apache ActiveMQ 项目内部。1.0 版的 README 署名“Apache ActiveMQ 团队”，网站位于 `activemq.apache.org/camel`，缺陷跟踪器设在 ActiveMQ 问题跟踪器之下<sup>[6](https://camel.apache.org//camel-dna/)</sup>。James Strachan 于 2007 年 3 月 19 日 10:54 UTC 推送了首次提交 `77b260b6`，提交信息为“首次提交 Camel 路由库”，包含两个模块中的 42 个文件<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。他于 2007 年 5 月 15 日在一篇题为“Java 中的企业集成模式”的博客文章中公开宣布了该项目<sup>[5](https://cwiki.apache.org/confluence/spaces/CAMEL/blog/2011/07/07/27821263/Happy%2BBirthday%2BCamel)</sup>。

根据中央 Maven 仓库中的时间戳，Camel 1.0 于 2007 年 7 月 2 日发布，从一开始就包含 Java DSL 和 Spring XML 支持<sup>[5](https://cwiki.apache.org/confluence/spaces/CAMEL/blog/2011/07/07/27821263/Happy%2BBirthday%2BCamel)</sup>。它附带 19 个组件，包括 activemq、cxf、ftp、http、irc、jms、jpa、mail、mina、quartz、rmi 和 xmpp<sup>[6](https://camel.apache.org//camel-dna/)</sup>。而 2026 年的一篇项目博客文章则称“Camel 1.0 于 2009 年 1 月发布”<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>；同时期的项目记录给出的是 2007 年 7 月 2 日。Camel 2.0 于 2009 年 8 月跟进，2.x 系列持续了十年<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。Apache 软件基金会董事会于 2008 年 12 月 17 日将 Camel 确立为项目，它于 2009 年 1 月成为顶级项目<sup>[10](https://apache.org/foundation/board/minutes/Camel.html)</sup><sup> • </sup><sup>[7](https://cwiki.apache.org/confluence/download/export/pdfexport-20260430-300426-1136-719493/Happy%2B5%2Byears%2Bbirthday%2BApache%2BCa_6ec7d74a5940425fbebcd2031954fdee-300426-1136-719494.pdf?contentType=application%2Fpdf)</sup>。

组件目录随着每一波技术浪潮而扩展：AWS 组件于 2011 年到来，Kafka 于 2014 年 2 月到来，[Spring Boot](https://www.edgepedia.org/zh/spring-boot) 支持于 2014 年 10 月到来，[Kubernetes](https://www.edgepedia.org/zh/kubernetes) 于 2015 年 9 月到来<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。到 4.x 系列时，项目还增加了 Camel Quarkus、Camel K、Camel Karaf 和 Kamelets 子项目，每个都有自己的发布列车<sup>[11](https://camel.apache.org/releases/)</sup>。

## 架构

Camel 的中心是 `CamelContext`，即包含并维系组件、路由、端点、类型转换器、注册表、数据格式和语言的运行时<sup>[8](https://camel.apache.org/manual/architecture.html)</sup><sup> • </sup><sup>[12](https://camel.apache.org/manual/camelcontext.html)</sup>。

**路由与处理器。** 路由告诉 Camel 消息应如何在系统之间移动，一条路由恰好有一个输入端点和 0 个、1 个或多个输出端点<sup>[8](https://camel.apache.org/manual/architecture.html)</sup>。在路由过程中，Exchange 从一个处理器流向另一个处理器，因此路由可以看作一张以专用处理器为节点的图<sup>[12](https://camel.apache.org/manual/camelcontext.html)</sup>。项目将这一模型浓缩为一句话：路由通过 Consumer 从端点接收消息，将每条消息封装在 Exchange 中，沿 Processor 链发送，并通过 Producer 交给一个或多个端点<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。

**组件。** 组件是用于向其他系统添加连接性的扩展点，每个组件都向 Camel 的其余部分暴露一个端点接口<sup>[8](https://camel.apache.org/manual/architecture.html)</sup>。每个组件——无论是 JMS（2007 年）、Kafka（2014 年）还是 LangChain4j（2024 年）——都通过实现一个创建 Producer 和/或 Consumer 的 `Endpoint` 接入同一模型；数百个组件都是同样三个接口的实现<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。

**DSL。** 路由规则可以用 Java、XML、Groovy 或 YAML 编写，并带有路由规则的 IDE 补全<sup>[1](https://camel.apache.org/manual/)</sup>。同一条路由可以用 Java DSL、XML DSL 或 YAML DSL 表达<sup>[8](https://camel.apache.org/manual/architecture.html)</sup>，路由也可以用 Kaoto 或 Karavan 工具进行可视化设计<sup>[2](https://camel.apache.org//what-is-apache-camel/)</sup>。

## 实践中的路由模型

首次提交中的第一个测试将路由定义为 `from("seda://a").to("seda://b")`，同一提交中还出现了使用 `choice()` 的基于内容的路由器；两者至今仍能编译和运行<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。Hohpe 和 Woolf 书中的企业集成模式映射到 Processor 链上：拆分器、聚合器、基于内容的路由器和线路窃听各自都是一个操作 Exchange 的 Processor<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。Camel 目前记录了其中 65+ 种模式<sup>[2](https://camel.apache.org//what-is-apache-camel/)</sup>。

由于端点 URI 决定连接性，将 `kafka:` 换成 `sftp:` 或 `rest:` 会改变传输方式，而路由逻辑保持不变<sup>[13](https://camel.apache.org/when-to-use/)</sup>。2007 年从 JMS 读取并写入文件的路由，在结构上与 2015 年从 Kafka 读取并写入 S3 的路由完全相同<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。

有史以来发布的第一个示例——Camel 1.0 中的 `camel-example-jms-file`——用大约 40 行 Java 代码从 JMS 队列读取消息并写入磁盘，需要嵌入式 ActiveMQ 代理和手动配置的连接工厂设置；如今同样的集成是一条 YAML 路由，用一条 `camel run` 命令启动，代理通过 `camel infra run artemis` 在容器中启动<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup><sup> • </sup><sup>[6](https://camel.apache.org//camel-dna/)</sup>。

## 使用与部署

Camel 是一个库，而不是平台：它嵌入现有的 Spring Boot 或 Quarkus 应用程序，像任何 Java 应用程序一样部署<sup>[13](https://camel.apache.org/when-to-use/)</sup>。典型用例是连接使用不同协议的系统、从 Kafka、AMQP 或 JMS 消费消息的事件驱动微服务，以及将遗留 SOAP 服务桥接到现代 REST API<sup>[13](https://camel.apache.org/when-to-use/)</sup>。Camel CLI 允许从单个 YAML 文件运行路由，无需项目设置<sup>[14](https://camel.apache.org/)</sup>。

项目自己的数据表明，它已在包括 CERN 的大型强子对撞机和 UPS 在内的组织中投入生产，后者每天处理数百亿条消息<sup>[4](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)</sup>。与 Spring Integration 相比，项目列举了 350+ 个连接器对约 40 个适配器、更丰富的企业集成模式支持（包括 saga、断路器和动态路由），以及面向非 Java 使用的 YAML DSL<sup>[13](https://camel.apache.org/when-to-use/)</sup>。

## 发布与支持模式

发布频繁，大约每月一次，项目指出为了长期演进，偶尔可能会引入破坏性变更<sup>[9](https://camel.apache.org/download/)</sup>。截至 2026 年底，受支持的系列是 4.18.x LTS（Java 17 和 21，生命周期终止于 2027 年 2 月）、4.22.x LTS（Java 17、21 和 25，生命周期终止于 2027 年 8 月）和 4.23.0<sup>[9](https://camel.apache.org/download/)</sup>。自 4.0.3 以来的每个版本都包含 PGP 签名的 CycloneDX SBOM（JSON 和 XML 格式），用于漏洞扫描<sup>[9](https://camel.apache.org/download/)</sup>。Apache 董事会在 2026 年中期报告了 95 名提交者和 49 名 PMC 成员，项目状态为“持续进行且活跃度高”<sup>[10](https://apache.org/foundation/board/minutes/Camel.html)</sup>。

## References

1. [Apache Camel user manual, Apache Camel](https://camel.apache.org/manual/)
2. [What is Apache Camel?, Apache Camel](https://camel.apache.org//what-is-apache-camel/)
3. [Apache Camel by the Numbers: 19 Years of Open Source Integration, Apache Camel](https://camel.apache.org//blog/2026/06/camel-by-the-numbers/)
4. [The DNA of Apache Camel: How a 42-File Commit Became the World's Integration Framework, Apache Camel](https://camel.apache.org/blog/2026/06/camel-dna-19-years/)
5. [Happy Birthday Camel, Apache Camel wiki](https://cwiki.apache.org/confluence/spaces/CAMEL/blog/2011/07/07/27821263/Happy%2BBirthday%2BCamel)
6. [Camel DNA, Apache Camel](https://camel.apache.org//camel-dna/)
7. [Happy 5 years birthday Apache Camel, Apache Camel wiki](https://cwiki.apache.org/confluence/download/export/pdfexport-20260430-300426-1136-719493/Happy%2B5%2Byears%2Bbirthday%2BApache%2BCa_6ec7d74a5940425fbebcd2031954fdee-300426-1136-719494.pdf?contentType=application%2Fpdf)
8. [Architecture, Apache Camel](https://camel.apache.org/manual/architecture.html)
9. [Downloads, Apache Camel](https://camel.apache.org/download/)
10. [Board history: Camel, Apache Software Foundation](https://apache.org/foundation/board/minutes/Camel.html)
11. [Releases archive, Apache Camel](https://camel.apache.org/releases/)
12. [CamelContext, Apache Camel](https://camel.apache.org/manual/camelcontext.html)
13. [When to use Apache Camel, Apache Camel](https://camel.apache.org/when-to-use/)
14. [Apache Camel home page](https://camel.apache.org/)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Data mining, warehousing, and big data › Big data platforms and frameworks

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/apache-camel

English original: https://www.edgepedia.org/apache-camel
