DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Frameworks
  4. Apache Camel Was Awesome from v1.0 Onward

Apache Camel Was Awesome from v1.0 Onward

Claus Ibsen user avatar by
Claus Ibsen
·
Jul. 01, 12 · Interview
Like (0)
Save
Tweet
Share
8.42K Views

Join the DZone community and get the full member experience.

Join For Free
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.
Apache Camel Release (agency) unit test Domain-Specific Language Awesome (window manager)

Published at DZone with permission of Claus Ibsen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Choose the Right Streaming Database
  • Create Spider Chart With ReactJS
  • DevOps for Developers: Continuous Integration, GitHub Actions, and Sonar Cloud
  • DevOps vs Agile: Which Approach Will Win the Battle for Efficiency?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: