Getting started with Camel, Spring and Maven

Getting up and running with Camel is not so hard, once you know how to do it. It took me a little more time than I wanted despite the extensive amount of examples provides by Camel. This post should help you get an up and running example in no time!

To start, I’ll start with the pom.xml:

This setups a simple application. Next, we’ll create a Camel route:

The nice thing here is that a route is also executable, which makes testing of the route really easy. As you can see here, the application is looking into the target location, and will process everything found there by giving an Exchange to the process method of the myProcessor bean. This bean is wired in the camel-context.xml, which should be placed in the src/main/resources/META-INF/spring directory.

And the MyProcessor bean:

And that’s it. That should get you up to speed with using Camel, Spring and Maven!