【Apache 之Camel 介绍】

Apache Camel ™ is a versatile open-source integration framework based on known Enterprise Integration Patterns.

Camel empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL. This means you get smart completion of routing rules in your IDE, whether in a Java, Scala or XML editor.



 

Apache Camel uses URIs to work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF, as well as pluggable Components and Data Format options. Apache Camel is a small library with minimal dependencies for easy embedding in any Java application. Apache Camel lets you work with the same API regardless which kind of Transport is used - so learn the API once and you can interact with all the Components provided out-of-box.

Apache Camel provides support for Bean Binding and seamless integration with popular frameworks such as CDI, Spring, Blueprint and Guice. Camel also has extensive support for unit testing your routes.

The following projects can leverage Apache Camel as a routing and mediation engine:

Apache ServiceMix - a popular distributed open source ESB and JBI container

Apache ActiveMQ - a mature, widely used open source message broker

扫描二维码关注公众号,回复: 271011 查看本文章

Apache CXF - a smart web services suite (JAX-WS and JAX-RS)

Apache Karaf - a small OSGi based runtime in which applications can be deployed

Apache MINA - a high-performance NIO-driven networking framework

Apache Camel是Apache基金会下的一个开源项目,它是一个基于规则路由和处理的引擎,提供企业集成模式的Java对象的实现,通过应用程序接口 或称为陈述式的Java领域特定语言(DSL)来配置路由和处理的规则。其核心的思想就是从一个from源头得到数据,通过processor处理,再发到一个to目的的.

这个from和to可以是我们在项目集成中经常碰到的类型:一个FTP文件夹中的文件,一个MQ的queue,一个HTTP request/response,一个webservice等等.Camel可以很容易集成到standalone的应用,在容器中运行的Web应用,以及和Spring一起集成.

Apache Camel十一个Java库和引擎,有多种不同的整合模式,然而他并不是BPMN或者ESB,虽然可以在此引擎下实现他们。Apache Camel是一个编程人员调节、整合问题的工具。

Message

org.apache.camel.Message是Camel中一个基本的包含数据和路由的实体,Messages包含了

唯一的识别(Unique Identifier)--java.lang.String类型

头信息(Headers)--会提供一些内容的提示,头信息被组织成名值对的形式,string-->Object

内容(body)是一个Object类型的对象,这就意味着,你要确保接收器能够理解消息的内容。当消息发送器和接收器使用不同的内容格式的时候,你可以使用Camel的数据转换机制将其转换为一个特定的格式。在许多情况下预先定义类型可以被自动转换。

错误标记(fault flag)使用来标记正常或者错误的标记,通常由一些标准类定义,例如(WSDL)

Exchange

org.apache.camel.Exchange 是一个消息之间通信的抽象的会话。下面列出的就是这样一个会话,使得组件更为全面

Exchange ID

MEP 一个类似InOnly或者InOut的消息交换模式。当模式是InOnly的时候,消息交换中只包含IN-Message

Exception在路由过程中的任何异常

Properties有点类似与message 的headers ,但是他们将持续到整个exchange结束,Camel还可能利用他们进行一些特殊的通信。

IN-Message

OUT-Message

猜你喜欢

转载自gaojingsong.iteye.com/blog/2367229