1. Home
  2. Integrations
  3. Apache Camel Architecture and Concepts

Apache Camel Architecture and Concepts

Read about the architecture and main concepts of Apache Camel

Apache Camel is an open-source integration framework that facilitates connecting systems and exchanging data between them using a route-based model.

In this section, we will present some fundamental concepts for understanding the logic of integrations.

For a deep and complete understanding, consult the official Apache Camel documentation. It offers a detailed view of features, patterns, and best practices.

Architecture

The diagram below shows an overview of the main concepts that make up the architecture of Camel.

Camel Architecture

  • The Camel context acts as the center that manages system integration.

  • Within the Camel context, the routing engine uses a DSL (Domain-Specific Language) to define and create routes.

  • Routes connect endpoints, which are entry and exit points for external systems, using different components.

  • Components provide connectivity and abstraction for various protocols and technologies, such as files, HTTP, JMS, among others.

  • Messages travel through these routes and are processed by processors, which transform and manipulate data as needed. They perform functions such as message filtering, EIPs, routing, transformation, mediation, enrichment, validation, and interception.

Concepts

Camel Context

The Camel context is the central core of the Camel application. It is responsible for managing the lifecycle of routes, components, and other resources.

Camel Context

Domain-Specific Language (DSL)

A DSL, or Domain-Specific Language, is a language designed for a specific domain that allows users to define and configure routes and integrations.

Camel supports DSLs in various languages, such as Java, Groovy, YAML, XML, among others. In Sensedia Integrations, we use YAML DSL for building routes.

Route

A route defines the path that a message follows within the integration system, showing the processing steps applied to the message as it travels from a source to a destination.

Generally, a route consists of a series of steps connected in a linear sequence, detailing how the message will be handled, routed, or mediated.

Routes are described using a simple and declarative syntax that makes them easy to read and understand.

See below an example of a Camel route in code format and diagram:

Route diagram example

  • The route starts with a REST trigger that receives POST requests on the /logs endpoint.
  • Then, the route logs a message with the value {{beforePost}}.
  • Next, it sends a POST request to the http://{{supermock}} endpoint, with the parameters:
    • bridgeEndpoint: true and
    • httpMethod: POST.
  • Finally, it logs the message "afterPost".
TIP

Check out a route example.

Message

A message is the minimum unit of data that is propagated and modified throughout a route. It consists of two main components:

  • Header: metadata associated with the message. Headers can include information such as identifiers, data types, or any other information relevant to message processing.

  • Body: can be any Java object. Typically it's a string, but can be transformed into more complex objects depending on the integration encoding or components involved.

Message

Exchange

Exchange is an object that encapsulates the message and some metadata during information exchange between systems. Additionally, it provides utility methods for use in integrations, such as the ability to save and retrieve properties.

Endpoints

Endpoints are components that represent a connection point where data can be sent or received within an integration flow. They define how data is accessed and manipulated in a system.

Endpoints are referenced in the DSL through URIs.

Components

Components are artifacts used in building a route that enable integration and communication between different systems and protocols. They act as connection points between Camel and the various external technologies or services you want to integrate in your routes, such as:

  • HTTP: makes a call to an HTTP endpoint;
  • FTP: gets or sends files to an FTP server;
  • Quartz: generates events according to a schedule.
NOTE

Enterprise Integration Patterns (EIPs)

EIPs, or Enterprise Integration Patterns, are integration patterns that describe common solutions to frequent problems found in integration systems and communication between applications.

They help structure and optimize communication between applications by providing methods for message routing, data transformation, message aggregation and splitting, message filtering, and error handling. Examples:

  • Split: divides a message into multiple parts for individual processing.
  • Choice: selects a specific route based on conditions or criteria.
  • On Exception: defines how to handle exceptions and errors during message processing.
TIP

As logic components, EIPs can be compared to the general tools used in Canvas-legacy integrations.

NOTE

Expression Languages

An expression language is a way to write instructions in EIPs that help process and manipulate data as they pass through an integration route.

Imagine you're moving data from one place to another, and you need to do something with that data, such as extract information, modify content, or decide where to send it. The expression language allows you to write these instructions in a way that Camel can understand and apply during the data flow.

For example, the condition for a Choice can be written using languages like Groovy, JSONPath, JQ, etc.

NOTE

Data Formats

Data formats are artifacts referenced by data transformation EIPs to determine the input or output format of data. They facilitate data conversion between formats such as XML, JSON, CSV, and others.

NOTE

For more information about data formats, access:

TIP
  • Before coding, design your integration flow.
  • Define the necessary steps for execution according to business rules.
  • Map these steps to the necessary components and/or EIPs.
  • Only then code!

How happy are you with this page?

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more