July 1, 2010

Getting Started with Apache Camel and Prepare for Apache ServiceMix Deployment

Apache Camel is dream framework for any developers that is confronting with any type of integration task. What makes Apache Camel so great is:
  • Testability. It is design from the beginning to be a framework that going to support Test Driven Development. With this follows a fast development cycle, since all code can be debugged and executed from a simple JUnit test case.
  • Solves the two foremost problem that an integrator faces:
  • Seamless protocol crossing, i.e. no coding for fetching data from e.g. HTTP and forwarding it to JMS.
  • Default implementation of Enterprise Integration Pattern (http://www.eaipatterns.com/toc.html) that is easy to extend and configure. If you are not familiar with EIP, I recommend you to take the time and read the EIP homepage or if you do not want to miss a thing read the complete book written by Hophe and Woolf (http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683).

The next best thing is that Apache Camel is a POJO based solution, which means that it can be deployed and ran in any deployment environment:
  • Standalone Java Application
  • Web Container
  • J2EE Container

When talking of deployment and integration the most common question is. What about ESB? And this is also when Apache Camel shines. Apache Camel is fully supported by Apache Camel parent project Apache ServiceMix, that supports the industry standard Java Business Integration standard. The JBI specification has been criticized about being a slow way of developing integration software and in many aspect that is true, but with Apache Camel as core developing framework that is no longer true.

The reason to select an ESB platform to deploy your integration software is:
  • Management. The ESB platform is specially design to manage integration programs.
  • Redundancy and Scalability. A good ESB platform is specifically design to handle these issues when the load and uptime requirements increases.

But one thing, that in my opinion, the Apache Camel homepage lack is good starting example of showing the above strength. So lets get started with NOT writing a production code example, but instead lets write a JUnit test case that you can debug, then you can continue of writing your production code.

In the below example I will also take into account that one day, you might want or NOT take the next step and move your Apache Camel code into a full blown ESB environment.

Lets first look at your Maven pom.xml.

To read more about all configuration options for the above endpoints, see http://camel.apache.org/components.html

An Apache Camel route can also be configured in a XML file, which is the natural choice since you want  things to configurable and not static defined in a Java class, but more about in my next blog.

1 comment:

Claus Ibsen said...

Hi Karl

Nice blog post. I took the liberty and added a link to it from the Camel articles link site

It takes some hours to be synced before the link shows up.