An Overview Of Apache Camel

Reading Time: 3 minutes

Introduction

Apache Camel is an open-source integration framework depending on Enterprise Integration Patterns. It is mediation engine that provides a Java object-based implementation of the Enterprise Integration Patterns using an API (or declarative Java Domain Specific Language) to configure routing and mediation rules. Camel supports different protocols, HTTP, FTP, JMS, FILE … etc. It also supports different languages like hadoop, python, php ..etc. and we can transfer data like XML, JSON, text ..etc

Why Apache Camel?

These days, Data sharing between companies has increased enormously. In a company, a number of systems of different types exist. Some of these may be legacy systems while some may be new. These systems often interact with each other and needs integration. This interaction or integration is not easy as the implementations of the systems, their message formats may differ. One way to achieve this is to implement code which bridges these differences. However, this will be point to point integration. If in future again there is change in a system the other might also have to be changed which is not good. Instead, of this point to point integration which causes tight coupling we can implement an additional layer to mediate the differences between the systems. This results in loose coupling and not affect much our existing systems.

Features of Apache Camel

  • Apache camel is a light weight framework. It can be deployed on a variety of containers like Tomcat, esbs etc.
  • The core feature of Camel is its routing and mediation engine. A routing engine will selectively move a message around, based on the route’s configuration.
  • Camel provides an extensive library of more than 80 components and these components enable Camel to connect over transports, use APIs, and understand data formats.
  • Apache camel uses Message Exchange Patterns(MEP). Apache camel exchange can hold any kind of message. It supports a variety of formats like xml, JSON etc.
  • It makes testing of asynchronous and distributed systems using messaging.
  • Camel has a built-in type-converter mechanism that ships with more than 150 converters. 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.

Creating a Apache Camel project via Intellij

We can use the intellij wizard to create camel project.

  • Open intellij and click on file -> new -> project... -> maven.
  • Enable the create from archetype checkbox.
  • Select org.apache.camel.archetypes:camel-archetype-java .

  • Edit project name as per your need.

  • You can also change the version if you want to:

  • After clicking on Finish button, you will be redirected to project structure as given in image.

Conclusion

Apache Camel is an open source framework that provides rule-based routing and mediation engine. Apache Camel essentially provides an implementation of various EIPs. It makes integration easier by providing connectivity to a very large 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. You simply need to provide appropriate endpoints at both ends. Camel is extensible and thus in future more endpoints can be added easily to the framework.

I hope the above information helps to get started with Apache Camel. Continue learning about camel by clicking here.