Basic Camel Architecture tutorial

This tutorial provides an overview of Camel architecture components.

The Camel architecture consists of:

  • CamelContext: This represents an instance of the Camel runtime environment running in a JVM. it represents a single Camel routing rulebase and works in a similar way to the Spring ApplicationContext.
  • End points: They represent a message producer or consumer used by Camel runtime.
  • Components: They are essentially a factory of Endpoint instances.
  • RouteBuilder: It encapsulates rules, end points, and components to be consumed by Camel runtime.

camel architecture

Due to Camel’s flexible nature, it can be deployed in a wide range of containers, such as Java Enterprise or OSGi containers.

The Camel Context

CamelContext acts as a runtime environment to manage:

  • Routes.
  • Components.
  • End points.
  • Messages.
  • JMX for remote management.
  • Tracing.

CamelContext can be instantiated and its life cycle can be managed using:

  • Java
  • Spring configuration files

There can be more than one CamelContext in a container, but they are isolated from each other. If any communication is needed between them, a transportation layer (such as a message queue) must be used.


Camel Components are responsible for creating end points during the route-building process. Camel uses connection pools and lazy initialization techniques to lower the cost of end point creation.

End Points

Camel End points are representations of a named software (FTP or file server, for instance) and a resource. Camel can retrieve (consumer end point) or send (producer end point) data from the end points for routing and data manipulation purposes. For example, a tcp://host:portaddress represents TCP-based communication.

Route Builders

Camel RouteBuilders represent routing rules used by process flow creation and EIPs. Each CamelContext contains one or more RouteBuilders, and they should be extended and added to the CamelContext by a developer to describe the routing rules.

Here is an example of RouteBuilder:

package com.acme.quotes;

import org.apache.camel.builder.RouteBuilder ;

public class MyRouteBuilder extends RouteBuilder {

   public void configure() {




MyRouteBuilder is a class that extends org.apache.camel.builder.RouteBuilder (an abstract Camel class), which is used to describe a complete routing rule.

The producer where Camel should capture data. The destination where Camel should deliver data.