Enterprise Integration Zone is brought to you in partnership with:

Claus Ibsen is a principal software engineer from FuseSource. Claus is a full time committer on the open source integration framework Apache Camel (http://camel.apache.org) and author of the Camel in Action book (http://www.manning.com/ibsen). Claus is the most active contributor to Apache Camel and is very active in the Camel community. Claus is a frequent speaker at various conferences. Claus is a DZone MVB and is not an employee of DZone and has posted 45 posts at DZone. You can read more from them at their website. View Full User Profile

Spring Integration Project Creation VS. Apache Camel Project Creation

04.18.2012
| 9417 views |
  • submit to reddit
One of the blogs I follow is from Gunnar Hillert, whom back in 2009 discovered Camel and wrote a nice blog entry. He also did some investigation of Camel alternatives as well. One of the alternatives is Spring Integration. Gunnar has since joined VMWare to be part of the Spring team.

So this morning I read the new blog post by Gunnar on how to create a Spring Integration project in STS tooling, which is posted here. The STS creates a simple out of the box example, that provides the following XML (in screenshot) as the main logic. Take a moment to see if you can figure out what it does. And then compare to the equivalent Camel example below.

Spring Integration - Simple Example created by STS tooling
And here is the Camel example using XML as well:

Apache Camel - The same example as above
Having both screenshots, I guess you can figure out that the example:

  1. reads input from the console
  2. upper case the input
  3. and prints it back on the console

This example will be provided out of the box in the upcoming Apache Camel 2.10, in the examples/camel-example-console directory. You can see the source code here.

You can run it from command line using Maven
mvn compile exec:java
And then press ctrl + c to stop the application.

Running the Camel example from command line

Or you can run it from within your IDE of choice, such as IDEA / Eclipse / FuseIDE by running the CamelConsoleMain class. For example as the screenshot shows below from IDEA.

Running the example from your editor such as IDEA

To create a new Camel project you can use the Camel Maven archetypes. Or use Fuse IDE which has a wizard just like STS to create a new Camel project.

A few notes about Camel. The example uses Spring and XML, however Camel can be used without Spring at all. We could use pure Java and define the Camel route in a Java class. You can also use Scala. And for XML we could also have used OSGi Blueprint.

In the example we use the built-in Simple language to upper case the input. You can chose to use more powerful dynamic languages such as Groovy, OGNL, Mvel, JavaScript etc as well.

With Camel you simply have more choices, and dont have to use XML at all.
Published at DZone with permission of Claus Ibsen, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Mark Fisher replied on Tue, 2012/04/24 - 11:33am

This post takes the original Spring Integration template blog completely out of context to suit the author's agenda, and frankly I find that rather annoying. Please see my response on the original post here: http://davsclaus.blogspot.se/2012/04/new-camel-example-to-compare-with.html

 

Gunnar Hillert replied on Fri, 2012/05/04 - 11:37am

Hi Claus,

As Mark noted, the simple template which I created last year is not targeted for utmost conciseness. The goal is to provide a starting point for users who will most likely be new to Spring Integration. Therefore, I believe it is better to provide a template that is more explicit (slightly more verbose) in order to give new users a better understanding of what is going on.

Also, the SpringSource Tool Suite (STS) templates will generate Maven projects by default. Thus, the resulting projects can not only be executed from within STS, but also via the command-line by simply executing:

$ mvn exec:java

For creating template projects through Maven, I am working on Maven archetype support as well. I hope to have that available very soon. However, we already have an initial version providing template support for Gradle [1]. Ultimately we will have templating support for STS, Maven and Gradle.

I found your statement “With Camel you simply have more choices, and dont have to use XML at all.” a bit unfair. We do have Scala[2] and Groovy[3] DSLs being developed for Spring Integration. And in regards to IDE support, Spring Integration is not only supported via STS, but IntelliJ IDEA also provides good Spring Integration support [4].

Furthermore, as far as I know Fuse IDE is not an open and free product. STS on the other hand (including Spring Integration support) will be completely open sourced under the EPL license for the STS 3.0 final release this summer. I hope this provides a bit more context. With Spring Integration you do indeed have choices.

[1] https://github.com/SpringSource/spring-integration-templates/tree/master/si-gradle-plugin

[2] https://github.com/SpringSource/spring-integration-scala

[3] https://github.com/dturanski/spring-integration-groovy-dsl

[4] http://blogs.jetbrains.com/idea/2011/12/intellij-idea-for-spring-integration-20-patterns/

Gunnar Hillert replied on Fri, 2012/05/04 - 11:37am

As Mark noted, the simple template which I created last year is not targeted for utmost conciseness. The goal is to provide a starting point for users who will most likely be new to Spring Integration. Therefore, I believe it is better to provide a template that is more explicit (slightly more verbose) in order to give new users a better understanding of what is going on.

Also, the SpringSource Tool Suite (STS) templates will generate Maven projects by default. Thus, the resulting projects can not only be executed from within STS, but also via the command-line by simply executing:

$ mvn exec:java

For creating template projects through Maven, I am working on Maven archetype support as well. I hope to have that available very soon. However, we already have an initial version providing template support for Gradle [1]. Ultimately we will have templating support for STS, Maven and Gradle.

I found your statement “With Camel you simply have more choices, and dont have to use XML at all.” a bit unfair. We do have Scala[2] and Groovy[3] DSLs being developed for Spring Integration. And in regards to IDE support, Spring Integration is not only supported via STS, but IntelliJ IDEA also provides good Spring Integration support [4].

Furthermore, as far as I know Fuse IDE is not an open and free product. STS on the other hand (including Spring Integration support) will be completely open sourced under the EPL license for the STS 3.0 final release this summer. I hope this provides a bit more context. With Spring Integration you do indeed have choices.

[1] https://github.com/SpringSource/spring-integration-templates/tree/master/si-gradle-plugin

[2] https://github.com/SpringSource/spring-integration-scala

[3] https://github.com/dturanski/spring-integration-groovy-dsl

[4] http://blogs.jetbrains.com/idea/2011/12/intellij-idea-for-spring-integration-20-patterns/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.