Looking at the impressive first Apache Camel release

In preparation for the CamelOne conference next week, I took time to look back in the history of the Apache Camel project. So among others 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 am with the fact of this release. Now you have to consider this was done 5 years ago, and in this release the Camel founders had already 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, then his ambitions 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 wagon, then fine. If you are into Groovy, then fine, if you want to use Ruby, then hell yeah (Ruby supported 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 projects DNA, and what makes IMHO Apache Camel stand out from the rest - The diverse and vibrant community and the DNA of the Camel project embracing "no shoe fits all".  

So lets take a look at this example with the Java DSL. Todays people using the latest Camel release, eg 2.9.2 should instant be familiar with the DSL - Something 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, you guys did 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 write 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, 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.

The last release of Apache Camel is 2.9.2, so lets migrate the old example to use this version instead. To do that you need to:
  • Adjust the pom.xml to use Camel 2.9.2 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. And the packages attribute is now a 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 it in Camel 1.0 release, the DSL from the example is fully compatible with todays 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.

1 comment:

Anonymous said...

Again another impressive blog entry of yours!

Personally I also want to thank you as well for ALL of your HARD works for the Apache Camel itself as well as it's community... KUDOS!

Babak Vahdat