Apache Camel is a rule-based routing and mediation engine that provide Java object-based implementation of the Enterprise Integration Patterns using an API (or declarative Java Domain Specific Language) to configure routing and mediation rules.
Enterprise Integrations are Complex as Enterprises have hundreds of applications as:
- complex communication pattern
- variety of transport such as HTTP, Queue, etc,
- variety of protocols such as HTTP, JMS, AMQP
The Evolution of cloud and microservices makes enterprise integration even more complex.
We can simplify enterprise integration by using enterprise integration patterns. Enterprise Integration pattern Uses Apache Camel for integration of different microservices and subsystems.
Why Apache Camel
Integration Can Be messy – the variety of protocols and data formats. Framework hides all complexity so you can focus on business logic. Camel is really simple to use and is very powerful it has tons of component as bean, browse, control bus etc,. It has great spring and bean integration as @produce, @consume,@beanInject, etc.
Apache Camel is-
1. Open Source Enterprise Integration Framework.
- Easily integrate system consuming or producing data
2. Inspired by “Enterprise Integration Patterns” – Gregor hohpe and Bobby Woolf
- Evolve to Microservices Architecture and cloud
3. Lean-Lightweight and Extensible
- Component architecture Keeps footprint low
- Provides 100+ Component for databases, message Queue,
- APIs, Cloud integration, etc,
- Supports 200+ protocols, transport and data formats (& 300+ converters)
Provides Domains Specific Language (DSL) customized to suit the needs of application integration
Features of Apache Camel:
Camel makes the integration easier by varieties of transports and APIs. Few example are, you can easily route JMS to JSON, JSON to JMS, HTTP to JMS, FTP to JMS, even HTTP to HTTP, and connectivity to different Microservices. You simply need to provide appropriate endpoints at both ends. Camel is extensible so that in the future more endpoints can be added easily to the framework.
- Camel supports plug-gable data formats and type converters for such message transformations, so new formats and converters can be added in the future. Currently, it supports several popular formats and converters; to name a few – CSV, EDI, JAXB, JSON, XmlBeans, XStream, Flatpack, and Zip.
- Camel supports the POJO model so that you can plug in Javabeans at various points.
The Architecture of Apache Camel
Work with Apache Camel Using its processor
Camel is a box that receives messages from some endpoint and sends it to another one. Within the box, the messages may be processed or simply it can be redirected.
A message in Apache Camel is an implementation of org.apache.camel Message interface
The Message has four main parts
any producer or consumer in the Camel route is an Endpoint Consider the Camel route as a graph and Endpoint as a Node.
A Message Container and Link between producer and consumer endpoints and hold information about
- producer and consumer endpoints
- message route
- protocol used
- any error or exception throw
Apache Camel Routing
Camel routes start with “from” that act as a consumer. Consumer can of the following types :
- Polling consumer (fetches message periodically)
- Event-Driven consumer (listens for events)
Consumers receive a message from the external system.
Then, the consumer wraps the message in a Camel-specific format called Exchange. And it starts routing between endpoints.
Producers are identical by the keyword “to”. Once the message is received producer will:
- Converting exchanges
- Delivering them to other channels
In this blog, we have covered the introduction to Apache Camel. Now you are ready to learn implementation using Apache Camel using Spring. For more, you can refer to the documentation: https://www.tutorialspoint.com/apache_camel/apache_camel_using_with_spring.htm
For more blogs please ref: