What is Apache Camel | CodeUsingJava

What is Apache Camel?

Apache Camel is a rule-based routing and 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. To better understand what is apache camel, lets first understand what are Enterprise Applications and Enterprise Integration Patterns.

Table Of Contents :

Video Tutorial

What is Enterprise Application Integration?

Consider a scenario of a big organization like Nike. They will be having different departments each having its own business softwares like supply chain management applications, ERP systems, CRM applications for managing customers, business intelligence applications, payroll and human resources. Such systems cannot communicate with one another in order to share data or business rules. For this reason, such applications are sometimes referred to as islands of automation or information silos. This lack of communication leads to inefficiencies, wherein identical data are stored in multiple locations, or straightforward processes are unable to be automated.
Apache Camel Tutorial
Enterprise application integration is the process of linking such applications within a single organization together in order to simplify and automate business processes to the greatest extent possible, while at the same time avoiding having to make sweeping changes to the existing applications or data structures.

What is Apache Camel?

Apache Camel EIP Tutorial
Implementing communication between the different department is a complex process as each department might have its own process and specifications. They might use different message data format and so communication between departments will require transformation of these messages. Implementing code for point to point communication between the departments is one solution. However this leads to tight coupling between the departments.Any change in one department will cause a lot of refactoring.
The best approach to this type of problem is to use a mediation framework. Mediation reduces complexity and provides a more flexible approach by adding and using a tier between the systems.
Apache Camel is a lightweight mediation framework which implements all EIPs and can be either run as standalone application or in various containers like Apache Tomcat, ESB's. Apache camel provides us with a number of components. These components make interacting create endpoints with which a system can interact with other external systems. For example using an ActiveMQ component we expose an ActiveMQ endpoint for interaction with external system.
Apache Camel Routes can be written in various Domain Specific Languages(DSL). Most popular are-
  • Java DSL - A Java based DSL
  • Spring XML - A XML based DSL in Spring XML files

What are EIPs?

When we write Java Code, we follow Design Patterns for better coding practices. Some of the benefits of using design patterns are: Design Patterns are already defined and provides industry standard approach to solve a recurring problem, so it saves time if we sensibly use the design pattern.
Similarly for Enterprise Application Integration we use Enterprise Integration Patterns as these are proven solutions for recurring problems during application integration.

When to Use Apache Camel?

Some scenarios are-
  • Development of new Integration Systems
  • Legacy Systems Integration
  • Replacing existing licensed integration frameworks like TIBCO