Camel Components组件库提供多种服务用于消息传递、数据收发,这些服务不仅可以解决简单的消息转换和传输数据,而且可以确保数据安全。在Camel整体的架构中,Conponents可以理解为和外部系统的连接器,可以安全的和外部各种数据、协议进行传输和转换。
Camel组件库提供多种组件能够接入File、HTTP,JMS,TCP,WS-*,WebSocket 等多种传输协议用于数据传递,同时还提供了多种数据处理方法XML、JSON、BEAN、DataFormat用于数据转换。
官网中关于 https://camel.apache.org/components/latest/index.html Camel组件库的介绍,分为核心组件和通用组件两大类。其中核心组件26个23个JAR包,常用组件315个246个JAR包。这些库都是官方长期维护支持的组件库。
组件清单
核心组件
组件 | 包名 | 官方支持 | 版本号 | 功能描述 |
---|---|---|---|---|
Bean | camel-bean | Stable | 1.0 | 用于调用Camel中注册的Java Bean |
Browse | camel-browse | Stable | 1.3 | Inspect the messages received on endpoints supporting BrowsableEndpoint. |
Class | camel-bean | Stable | 2.4 | 用于调用Camel中使用Class Name注册的Java Bean |
Control Bus | camel-controlbus | Stable | 2.11 | 管理和监控Camel routes |
Data Format | camel-dataformat | Stable | 2.12 | 可以像普通Camel Component一样使用Data Format |
Dataset | camel-dataset | Stable | 1.3 | Provide data for load and soak testing of your Camel application. |
DataSet Test | camel-dataset | Stable | 1.3 | Extends the mock component by pulling messages from another endpoint on startup to set the expected message bodies. |
Direct | camel-direct | Stable | 1.0 | Call another endpoint from the same Camel Context synchronously. |
Direct VM | camel-directvm | Stable | 2.10 | Call another endpoint from any Camel Context in the same JVM synchronously. |
File | camel-file | Stable | 1.0 | Read and write files. |
Kamelet | camel-kamelet | Preview | 3.8 | The Kamelet Component provides support for interacting with the Camel Route Template engine |
Language | camel-language | Stable | 2.5 | Execute scripts in any of the languages supported by Camel. |
Log | camel-log | Stable | 1.1 | Log messages to the underlying logging mechanism. |
Mock | camel-mock | Stable | 1.0 | Test routes and mediation rules using mocks. |
Ref | camel-ref | Stable | 1.2 | Route messages to an endpoint looked up dynamically by name in the Camel Registry. |
REST | camel-rest | Stable | 2.14 | Expose REST services or call external REST services. |
REST API | camel-rest | Stable | 2.16 | Expose OpenAPI Specification of the REST services defined using Camel REST DSL. |
Saga | camel-saga | Stable | 2.21 | Execute custom actions within a route using the Saga EIP. |
Scheduler | camel-scheduler | Stable | 2.15 | Generate messages in specified intervals using java.util.concurrent.ScheduledExecutorService. |
SEDA | camel-seda | Stable | 1.1 | Asynchronously call another endpoint from any Camel Context in the same JVM. |
Stub | camel-stub | Stable | 2.10 | Stub out any physical endpoints while in development or testing. |
Timer | camel-timer | Stable | 1.0 | Generate messages in specified intervals using java.util.Timer. |
Validator | camel-validator | Stable | 1.1 | Validate the payload using XML Schema and JAXP Validation. |
VM | camel-vm | Stable | 1.1 | Call another endpoint in the same CamelContext asynchronously. |
XSLT | camel-xslt | Stable | 1.3 | Transforms XML payload using an XSLT template. |
XSLT Saxon | camel-xslt-saxon | Stable | 3.0 | Transform XML payloads using an XSLT template using Saxon. |
常用组件
可以看到官方的组件库数量还是很庞大的,整体生态相当丰富,这么多组件势必让大家会眼花缭乱了。在后续的章节中依次按照接入协议和数据转换处理两个大类来分别给大家讲解Camel组件库的组件。