Apache camel for Beginner's
Camel is a versatile integration framework provides simple, manageable abstractions for the complex systems that you are integrating and the “glue” for plugging them together seamlessly. Apache Camel is such an integration framework. It is a versatile open-source integration framework based on known Enterprise Integration Patterns.
Camel have very important feature named "message routing". It has two main ways of defining routing rules: the Java-based domain specific language (DSL) and the Spring XML configuration format.Camel is a mature open source project, available under the liberal Apache 2 license, and it has a strong community.
What is Camel?
Camel is a routing engine or we can say it is a routing engine builder. By allows you to define your own routing rules, it helps you to decide from which source to accept message and what process has to done and send the message to other destination. Important fact of camel is that it makes no assumptions about the type of data you need to process. So it gives the developer, an opportunity to integrate any kind of system, without the need to convert your data.
Camel isn’t an enterprise service bus (ESB), but some call Camel a lightweight ESB because of its support for routing, transformation, monitoring, orchestration, and so forth. Camel doesn’t have a container or a reliable message bus, but it can be deployed in one, such as Open-ESB or the previously mentioned ServiceMix. For that reason, we prefer to call Camel an integration framework rather than an ESB.
you can define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL.
•Java DSL
from ("file:/sample").to("jms:sampleQueue");
•Spring DSL
<route>
<from uri="file:/sample"/>
<to uri="jms:sampleQueue"/>
</route>
•Scala DSL
from "file:/sample" -> "jms:sampleQueue"
In all the above examples we define a routing rule that will load files in the “/sample” directory into memory, create a new JMS message with the file contents, and send that message to a JMS queue named sampleQueue.
These are the concepts that Camel was built upon. Since then many other interesting features have been added. I recommend reading Camel in Action.
•Pluggable data formats and type converters for easy message transformation between CSV, JAXB, JSON, XmlBeans, XStream, Zip, etc.
•Pluggable languages to create expressions or predicates for use in the DSL. Some of these languages include: OGNL, JavaScript, Groovy, Python, PHP, Ruby, SQL, XPath, XQuery, etc.
•Support for the integration of beans and POJOs in various places in Camel.
•Excellent support for testing distributed and asynchronous systems using a messaging approach
Own custom Solution:
Implement an individual solution that works for your problem without separating problems into little pieces. This works and is probably the fastest alternative for small use cases. You have to code all by yourself.Integration Framework:
Use a framework, which helps to integrate applications in a standardized way using several integration patterns. It reduces efforts a lot. Every developer will easily understand what you did. You do not have to reinvent the wheel each time.Enterprise Service Bus (ESB):
Use an ESB to integrate your applications. The ESB often also uses an integration framework. But there is much more functionality, such as business process management, a registry or business activity monitoring. You can usually configure routing and such stuff within a graphical user interface. Usually, an ESB is a complex product. The learning curve is much higher than using a lightweight integration framework.If you decide to use an integration framework, you still have three good alternatives in the JVM environment: Spring Integration, Mule, and Apache Camel. They are all lightweight, easy to use and implement the EIPs. Therefore, they offer a standardized way to integrate applications and can be used even in very complex integration projects.
My personal favorite is Apache Camel due to its awesome Java DSLs, combined with many supported technologies.
Examples:
Camel In Action
No comments:
Post a Comment