...
Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It integrates very well with the Java platform. Our Scala DSL implementation is built on top of the existing Java-based DSL, but it adds Scala syntax sugar to make building routes even more convenient.
Getting started
Just like the Java DSL, the Scala DSL has a RouteBuilder (org.apache.camel.scala.dsl.RouteBuilder
) class that you have to extend to implement your own routes. This example shows you two very simple routes.
Wiki Markup |
---|
{snippet:id=basic|lang=java|url=activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/BasicRouteBuilderTest.scala} |
If you compare this to the Java DSL, you notice:
Documentation
- Scala DSL - Getting Started gives you basic information on how to use the Scala DSL.
- Scala DSL - EIP shows you the Scala DSL syntax for every EIP supported
- there is no configure() method to override
- a route starts directly with a URI instead of
from(uri)
→
is just an alias forto
References
- At ApacheCon Europe 2008 there was a Fast Feather talk that introduced some of the basic Scala language concepts that are being used for building the Scala DSL. Here are the presentation slides .
...