What is Apache Camel ?

What is Apache Camel ? Apache Camel is an open source integration framework that aims to make integrating systems easier. At the core of the Camel framework is a routing engine, or more precisely a routing-engine builder. It allows you to define your own routing rules, decide from which sources to accept messages, and determine how to process and send those messages to other destinations.

Camel has two main ways of defining routing rules:

  • Java-based domain-specific language ( DSL )
  • Spring XML configuration format.

What is not camel?

We should also mention what Camel isn’t. Camel isn’t an enterprise service bus, although some call Camel a lightweight ESB because of its support for routing, transformation, monitoring, orchestration, and so forth. Camel doesn’t have a container or a reliable message bus, but it can be deployed in one, such as WildFly Application Server. There is a supported version of Camel which is part of Red Hat Fuse.

Camel EIPs

Camel is heavily based on EIPs. Although EIP s describe integration problems and solutions and also provide a common vocabulary, the vocabulary isn’t formalized. Camel tries to close this gap by providing a language to describe the integration solutions. There’s almost a one-to-one relationship between the EIP and some Camel components. Check this tutorial to learn more about it:  Basic Enterprise Integration Patterns with Camel

Camel’s domain-specific language ( DSL ) is a major contribution to the integration layer. The purpose of the DSL is to allow the developer to focus on the integration problem rather than on the tool—the programming language.

Here are some examples of the DSL using different languages and staying functionally equivalent:

Java DSL:


Spring DSL:

<?xml version="1.0" encoding="UTF-8"?><route>
   <from uri="file:data/inbox"/>
   <to uri="jms:queue:order"/>

This example shows how easily you can route files from a folder to a JMS queue.

Camel products

Apache Camel 3 is a new family of products which include:

  • Camel 3: The core integration framework
  • Camel K: A lightweight Serverless Integration Platform Camel on Kubernetes & Knative
  • Camel Quarkus: Camel extensions for Quarkus Optimized JVM & Native compiled Java (GraalVM)

Apache Camel is distributed with the following archetypes: https://camel.apache.org/manual/latest/camel-maven-archetypes.html

Getting started with Camel

Camel is available from the official Apache Camel website a thttps://camel.apache.org/download/. On that page you’ll see a list of all the Camel releases and also the downloads for the latest release. Each dstribution contains a set of items:

  • doc:Contains the Camel Manual in PDF and HTML formats. This user guide is a download of a large portion of the Apache Camel wiki at the time of release.
  • examples: Includes Camel examples.
  • lib: Contains all Camel libraries and third-party dependencies needed for the core of Camel to run.

So, the Camel distribution is useful mostly as reference for your projects. To get started, it is sufficient to create a Maven project and add Camel dependencies in it. You can also leverage Camel archetypes for a quicker start

For example:

$ mvn archetype:generate   -DarchetypeGroupId=org.apache.camel.archetypes  -DarchetypeArtifactId=camel-archetype-java   -DarchetypeVersion=3.7.0   -DgroupId=com.masterspringboot.camel   -DartifactId=camel-helloworld  -Dversion=1.0-SNAPSHOT

The following resources will be created:

├── data
│   ├── message1.xml
│   └── message2.xml
├── main
│   ├── java
│   │   └── com
│   │       └── masterspringboot
│   │           └── camel
│   │               ├── MainApp.java
│   │               └── MyRouteBuilder.java
│   └── resources
│       └── log4j2.properties
└── test
    ├── java
    │   └── com
    │       └── masterspringboot
    │           └── camel
    └── resources

The basic project includes a Main Application and a Route Builder.

We have just covered the basics of what is Apache Camel. You can continue learning about Apache Camel from here: HelloWorld Camel tutorial

Exit mobile version