Over a million developers have joined DZone.

Apache Camel Was Awesome from v1.0 Onward

DZone 's Guide to

Apache Camel Was Awesome from v1.0 Onward

· Integration Zone ·
Free Resource
I recently took time to look back into the history of the Apache Camel project. So among other versions I had a look at the first official 1.0 release of Apache Camel.

Apache Camel 1.0 - 5 years ago

The more I looked the more impressed I was with the first release. Now you have to consider this was done 5 years ago, and in this release the Camel founders had already established these features in the DNA of the project:

  • Java DSL
  • XML DSL (using Spring)
  • OSGi on the roadmap
  • camel-core JAR of 660kb
  • 18 external components (+ whats in camel-core)
  • 2 working examples
  • full website with documentation included, incl FAQs
  • Project logo and box
  • The Camel Maven plugin to easily run Camel and its examples
  • Test Kit
Below is a screenshot of the tar ball distribution of this release:

Camel 1.0 distribution (hint the OSGi ambitions in the pom.xml)

When you hear James talk about the past and how he created Camel, his ambition was that Camel should not restrain you. If you want to use Java and not XML then fine. If you are on the Spring XML bandwagon, then fine. If you are into Groovy, then fine, if you want to use Ruby, then hell yeah (Ruby support was added in Camel 1.3).

Lets take a look down the lane of the DSLs. Apache Camel is most likely the first integration project that offers multiple language DSLs out of the box in its very first release. It is simply in the project's DNA and what makes Apache Camel stand out from the rest IMHO is the diverse and vibrant community and embracing of the "one size does not fit all" philosophy.  

So lets take a look at this example with the Java DSL. People using the latest Camel release should be instantly be familiar with the DSL.  It just works from the very beginning!

Java DSL in Camel 1.0

And a sample of the XML DSL, which you can see in the source code as well.

XML DSL in Camel 1.0
And in this first release we also have the excellent Test Kit.  For example, notice the usage of mocks and setting up expectations in the screenshot below. Testing Camel was made easy from day-1. Yes its in the DNA of the Camel project.

Camel Test Kit already in Camel 1.0

And notice from the unit test above, the reference to the founders of Apache Camel.

  • James Strachan
  • Rob Davies
  • Hiram Chirino
  • Guillaume Nodet

Thanks guys for creating this marvelous project. Impressive first release from 5 years ago.

I will end this blog by running the camel-example-spring from the Apache Camel 1.0 release.
$cd examples
$cd camel-example-spring
$mvn compile
$mvn camel:run
Now you should have patience as Maven is downloading ancient JARs that are 5 years old. So it takes a while :)

Camel 1.0 example running

The screenshot above shows the Camel 1.0 example running. This example kicks off by consuming messages from a JMS queue and writes those to a file. So we need to connect with jconsole, to send a message. I have highlighted the service url to use in jconsole.

jconsole to send a message - Camel 1.0 rocks

In jconsole we expand the tree and find the test queue, and invoke the sentTextMessage operation with the text "Camel 1.0 rocks".

In the 2nd screenshot above, you may notice in the last line from the console, it says "Received Exchange". This is Camel logging this exchange as the example uses the following route shown in the screenshot in the top of this blog.

We can then see the file was written to the test directory as well, where we can see the file name is the message id, and the file content is what we sent from jconsole:

This was 5 years ago, so lets fast forward to today.

Lets migrate the old example to use the current version of Camel instead. To do that you need to:

  • Adjust the pom.xml to use Camel 2.9 - 2.10 and the camel-activemq component has been moved from Camel to ActiveMQ so you need to include that. And for logging we now use slf4j. The modified pom.xml is shown below
Upgrading the example from Camel 1.0 to 2.9.2, adjusting the pom.xml file

  • In the Spring XML file you need to change the namespace of Camel, as when Camel graduated to become an Apache Top Level Project, the namespace was migrated from activemq to camel. Also we upgrade to use Spring 3.0 in the XSD. And the activemq component is now from ActiveMQ and not Camel. The packages attribute is now an xml tag, so you need to use <packlage> in the <camelContext>. The updated file is shown below:
Upgrading Spring XML from Camel 1.0 to Camel 2.9.2

Okay we are now ready to go. 

There is no need for changes in the Java source code!!!

The example migrated from Camel 1.0 to 2.9.2 without any Java code changes!!!

And like before we use JConsole to send a text message.

I must say James and the founders hit the nail on the head in the Camel 1.0 release.  The DSL from the example is fully compatible with today's Camel release.

Indeed a very impressive first release. Camel was off to a great start, and the project has grown from strength to strength ever since.

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}