Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following illustration provides a high-level view of the main concepts that comprise the Camel Architecture:

...

Table of Contents
minLevel1
maxLevel7

CamelContext

At the core of Camel is the CamelContext and it is the container that is the runtime of Camel. It is the runtime system that links everything together and provides access to many useful services:

...

Service

Description

Components

Contains the Camel components that are factory of endpoints

Endpoints

Camel abstraction that models the end of a channel which can send or receive messages

Routes

Represents a chain of processors

Data Formats

List of available data formats

Languages

Used to wire together endpoints and processors

Type Converters

Allows for the conversion from one type to another

Registry

Contains a registry to allow for the lookup of beans

Routing Engine

Camel’s routing engine is what moves messages under the hood. This engine isn’t exposed to the developer, but you should be aware that it’s there and that it does all the heavy lifting, ensuring that messages are routed properly.

Routes

Routes are a core abstraction for Camel. The simplest way to define a route is as a chain of Processors. There are many reasons for using routers in messaging applications. By decoupling clients from servers, and producers from consumers, routes can for example do the following:

...

Every route developed in Camel has a unique identifier that’s used for logging, debugging, monitoring, and starting and stopping routes.

Domain Specific Language (DSL)

To wire processors and endpoints together to form routes, Camel defines a DSL (either Java or XML). Camel provides multiple DSL languages, so you could define the same route by using the XML DSL, like this:

...

NOTE: The DSLs provide a nice abstraction for Camel users to build applications with. Under the hood, though, a route is composed of a graph of processors.

Processors

The processor is a core Camel concept that represents a node capable of using, creating, or modifying an incoming exchange.

...

In some situations, processors don’t set an out message, so in this situation the in message is reused. At the end of a route, the MEP of the exchange determines whether a reply needs to be sent back to the caller of the route. If the MEP is InOnly, no reply will be sent back.

Endpoint

An endpoint is the Camel abstraction that models the end of a channel through which a system can send or receive messages.

...

This illustration shows how an endpoint works together with an exchange, producers, and consumers.

...

Producer

A producer is an abstraction that refers to an entity that is capable of transmitting a message to an endpoint. When a message is sent to an endpoint, it is the role of the producer to handle the details of getting the message data compatible with that particular endpoint.

For example, FileProducer will write the message body to a java.io.File format. While, JmsProducer, will map the message to javax.jms.Message before sending it to a JMS destination. This is an important attribute of Camel, since it hides the complexity of interacting with any one particular transports. All you need to do is route a message to an endpoint, and the producer will do all of the heavy lifting.

Consumer

A consumer is a service that receives messages produced by an external system, then wraps them in an exchange, and sends them onward to be processed. Consumers are the source of the exchanges being routed in Camel.

To create a new exchange, a consumer will use the endpoint that wraps the payload being consumed. A processor is then used to initiate the routing of the exchange in Camel via the routing engine.

Camel has two kinds of consumers: event-driven consumers, and polling consumers (or scheduled polling consumers). The differences between these consumers are important, because they help solve different problems.