...
Just like the Java DSL, the Scala DSL has a RouteBuilder (org.apache.camel.scala.dsl.RouteBuilder
) class that can be extended.
{snippet:iyou 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:
- 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 .
Enterprise integration patterns
Pipeline
There is a simple syntax available for specifying pipeline, by simple putting to
or &rarr
between the different steps in the pipeline.
Wiki Markup |
---|
{snippet:id=simple|lang=java|url=activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala} |
For more advanced use cases, you can also use a block-based syntax.
Wiki Markup |
---|
{snippet:id=block|lang=java|url=activemq/camel/trunk/components/camel-scala/src/test/scala/org/apache/camel/scala/dsl/PipelineRouteBuilderTest.scala} |
TODO
TODO: Create a Scala alternative and example for every EIP available on http://activemq.apache.org/camel/enterprise-integration-patterns.html
...