Apache Camel a Popular Open Source Integration Framework

0
1105
Advertisement

Apache Camel is a Java framework that simplifies the integration of complex systems. It saves developers from having to develop custom integration software for each system by offering a ‘one application fits all’ model.

Technology is growing at a rapid pace. Companies tend to move to newer, more stable, cost effective and scalable technologies. With this comes the challenge of integrating different systems that use different technologies, data formats and protocols. Integrating such complex systems from scratch is usually costly, tedious and seldom successful. Typically, it is more effective and less risky to make use of existing proven frameworks. Apache Camel is an open source integration framework, which focuses on integrating complex systems that use different protocols and technologies, seamlessly.

When should Apache Camel be used?

Enterprise application integration is necessary in every company. New technologies, formats and protocols make it difficult to integrate systems. Writing custom code every time is not the solution as it often entails work for simple integrations. A simple integration like getting data from a Java API and sending it to an SFTP location on an event would work as shown in Figure 1.

Figure 1: Simple integration
Advertisement

As the complexities like sending/receiving data from many applications increase, where there are various protocols like SOAP, REST, SFTP and diverse systems involved, it becomes very difficult to manage and write the code. It also increases maintenance costs. Imagine a complex scenario where the data is retrieved from the database through the Java APIs and then sent to the REST component, which gives a response that is then sent to some SFTP location (as shown in Figure 2). This itself sounds very complex, but companies have even more complex scenarios than this as they want to integrate with all the applications.

Another scenario can be taking data from Twitter feeds and sending it to a system that does sentiment analysis on the data. The system then sends this analysed data to another application, which parses and sends the analytical charts to Slack Channel. Doesn’t this seem rather complex?

It is pretty difficult to build such complex integration scenarios. The Apache Camel integration framework can be of help here. Camel just works like a jigsaw puzzle — we have all the bits and pieces that are ready, standard and proven. We only have to assemble them properly to complete the scene.

These bits and pieces of a jigsaw puzzle are the components, endpoints and routes in Camel.

Here is an example:

from(“twitter://timeline/home?type=polling&delay=60&consumerKey=[s]&consumerSecret=[s]&accessToken=[s]&accessTokenSecret=[s]”)

.to(“file:twitter”);

The above example shows a route with two components —Twitter and the file.

  • The Twitter component has the endpoint ‘timeline/home’ and parameters like type, delay and more.
  • The file component has the endpoint ‘twitter’. Here ‘twitter’ is a local folder in the file system.
  • In this example, the Twitter component will poll data every 60 seconds and send this to a local file system.

This simple example shows how easy it is to integrate systems with Apache Camel.

Sample examples for the file component can be found at https://github.com/sumeetpatil/camel-samples. More examples of Apache Camel can be found at https://github.com/apache/camel/tree/master/examples.

Figure 2: Complex integration

Why use Apache Camel?

Apache Camel follows enterprise integration patterns. Writing some spaghetti code and letting the applications work together is not the standard practice. Some standards must be followed before writing any code. Enterprise integration patterns, which are standard design patterns, aim to integrate new and existing software.

  • To define routes, Camel offers domain specific languages (DSL) for programming like Java DSL, Spring DSL, Scala DSL, and more. The purpose of Java DSL is to allow developers to focus on the integration problem rather than the programming language.
  • Camel provides ore than over 300 components and the list is growing.
  • It requires minimal configuration using an easy URI configuration.

Here is an example:

from(“file:inbox/data”)

Apache Camel is an awesome integration framework which is widely used by most companies. In an era when technology is moving at a really fast pace, integration plays a vital role and we cannot think of a better framework than Apache Camel for this.

Advertisement

LEAVE A REPLY

Please enter your comment!
Please enter your name here