|
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: class MyRouteBuilder extends RouteBuilder { "direct:a" --> "mock:a" "direct:b" to "mock:b" } If you compare this to the Java DSL, you notice:
Setting the route IDTo assign the unique ID to the Scala route, insert the routeId method invocation after the "from" part of the DSL. "direct:a" routeId "route-b" to "mock:b" Creating a new Camel Scala projectCamel 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. The generated project has a "readme" file with more instructions, and is ready to compile and run from Maven using: mvn compile exec:java |