You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Just like the Java DSL, the Scala DSL has a RouteBuilder class (org.apache.camel.scala.builder.RouteBuilder) that you can extend to implement your own routes. This example shows two very simple routes:

Error formatting macro: snippet: java.lang.NullPointerException

If you compare this to the Java DSL, you notice:

  • there is no configure() method to override
  • a route starts directly with a URI instead of from(uri)
  • is just an alias for to

Creating a new Camel Scala project

Camel offers Maven archetypes that allow you to quickly setup a new project.

To do this, you can execute the following Maven goal from the command line (using Maven 3.0.3 or better):

mvn archetype:generate

This runs Maven interactively - just type camel and press <Enter> to filter for Camel-related archetypes.
From the list, pick the number for camel-archetype-scala, then fill in the remaining details (such as the Camel version, et cetera).

The generated project has a "readme" file with more instructions, and is ready to compile and run from Maven using:

mvn compile exec:java
  • No labels