Apache Camel Tutorial (2021) | TechGeekNxt >>

Apache Camel Tutorial - Architecture

Apache Camel

In this tutorial we will be looking at Apache Camel Architecture, internal working of Apache Camel and it's components.

We will cover the following topics:

    What is a Apache Camel?
    Apache Camel Features
    Terminology and Concepts of Camel
    Apache Camel Architecture
    Apache Camel Advantages and Disadvantages

What is a Apache Camel?

Apache Camel is an open-source integration framework for implementing various Enterprise Integration Patterns(EIPs), that allows you to quickly and easily connect different systems that consume or produce data.

It is easy to use Domain Specific Languages (DSLs) to wire EIPs and transports together

Camel receives messages from some endpoint and sends it to another one. The messages can be processed or simply routed to different endpoint depending on transformation logic applied in Camel.

Apache Camel

It allows integration simple by providing connectivity to a wide variety of transports and APIs.
For example, you can easily route JMS to JSON, JSON to JMS, HTTP to JMS, FTP to JMS, even HTTP to HTTP, and connectivity to Microservices.

Apache Camel Features

Here are some of Camel's most important features that you could find useful when designing Camel applications.

  1. Apache camel is a light weight framework. It can be deployed on a various number of containers like Tomcat, ESBS etc.
  2. Apache camel provides us with a wide range of components. These components make interacting create endpoints with which a system can interact with other external systems. There are more than 150 components provided by Apache Camel.
    Example: Components like ActiveMQ, Kafka, Rest API's, FTP, JMX, HTTP etc.
  3. Apache camel utilizes Message Exchange Patterns(MEP). Apache camel exchange can hold any kind of message. It supports a wide range of formats like xml, JSON etc.
  4. Camel provides many various type of converters for marshaling and unmarshalling the message during routing. Routes in a variety of domain-specific languages (DSL).
    The most popular ones are
    • Java DSL - A Java based DSL using the fluent builder style.
    • Spring XML - A XML based DSL in Spring XML files.
  5. When using Spring XML we can make use of Spring support for features like Transaction Management, JPA etc.
  6. Camel supports pluggable languages to write predicates in DSL.

Terminology and concepts of Camel

Now, Let's now discuss the basic Camel terminology

  • Endpoint is a channel through which system can receive or send a message. It can refer to a web service URI, queue URI, file, email address, etc
  • Message contains data which is being transferred to a route. Each message has a unique identifier and it's constructed out of a body, headers, and attachments.
  • Exchange is the container of a message and it is created when a message is received by a consumer during the routing process. Exchange allows various types of interaction between systems, it can define a one-way message or a request-response message.
  • Component Component references are used to locate a component within an assembly. Apache Component References provides a variety of references that provide services for messaging, transmitting data, notifications, and a variety of other services that can not only resolve simple messaging and data transfer but also provide data security.
    1. Core Components
      Total Core Components: 25 in 22 JAR artifacts. Some of them are Bean, log,Class, REST API, Timer, XSLT etc..
    2. Non-Core Components
      There are total Non-Core Components: 320 in 247 JAR artifacts (1 deprecated). Some of them are activemq, amqp, atom, aws, aws lamda, kafka, aws mq, crypto etc..
    To know the compete list of core and non-core, can visit Apache Camel Components.
  • Route in Apache Camel is a collection of steps that Camel performs in order to consume and process a message. A Camel route begins with a customer and progresses through a series of endpoints and processors.
    Routes in Java are found within a RouteBuilder class, which has a configure() method where you can add your route code.
  • Processor is a simple Java interface which is used to add custom integration logic to a route. It contains a single process method used to preform custom business logic on a message received by a consumer.
  • CamelContext represents the Camel runtime system and it wires different concepts such as routes, components or endpoints.

Apache Camel Architecture

Camel utilizes a Java based Routing Domain Specific Language (DSL) or XML Configuration to configure routing and mediation rules which are added to a CamelContext to implement the various Enterprise Integration Patterns.

Apache Camel Architecture

At a high level Camel, CamelContext have a collection of Component instances. A Component is essentially a factory of Endpoint instances. You can explicitly configure Component instances in Java code or an IoC container like Spring, or they can be auto-discovered using URIs.

An Endpoint is a channel through which system can receive or send a message. It can refer to a web service URI, queue URI, file, email address, etc

The Domain Specific Language (DSL) uses pluggable Languages to create an Expression or Predicate to make a truly powerful DSL, which is extensible to the most suitable language depending on needs. Most of the Languages also supports Annotation Based Expression Language.

Apache Camel Advantages

  • Best lightweight integration solution
  • Producing to and consuming from any messaging system
  • Message type conversion
  • Large support library
  • Camel integrates well with well known frameworks like Spring Boot, and other middleware products, allowing it to be deployed however you need to deploy it.
  • There are over 150 components for the Camel framework that help integrate with diverse software platforms.

Apache Camel Disadvantages

Documentation could use some more detail

Take a look at our suggested posts:



Recommendation for Top Popular Post :