You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/04/13 08:56:00 UTC

[1/2] camel git commit: Component docs for scala

Repository: camel
Updated Branches:
  refs/heads/master 578ae7e9b -> 81f7515e5


Component docs for scala


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/26f1e959
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/26f1e959
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/26f1e959

Branch: refs/heads/master
Commit: 26f1e959d4f87257763703ff3a4f8b7f75897ceb
Parents: 578ae7e
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 13 10:53:07 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 13 10:53:17 2017 +0200

----------------------------------------------------------------------
 .../apache/camel/model/ProcessDefinition.java   |   2 +-
 .../model/cloud/ServiceCallDefinition.java      |   2 +-
 .../src/main/docs/scala-dsl-eip.adoc            | 224 -------------------
 .../main/docs/scala-dsl-getting-started.adoc    |  59 -----
 .../docs/scala-dsl-supported-languages.adoc     |  30 ---
 .../camel-scala/src/main/docs/scala-dsl.adoc    |  76 -------
 .../camel-scala/src/main/docs/scala-eip.adoc    | 224 +++++++++++++++++++
 .../src/main/docs/scala-getting-started.adoc    |  59 +++++
 .../main/docs/scala-supported-languages.adoc    |  30 +++
 components/camel-scala/src/main/docs/scala.adoc |  78 +++++++
 components/readme.adoc                          |   4 +-
 11 files changed, 395 insertions(+), 393 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/camel-core/src/main/java/org/apache/camel/model/ProcessDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessDefinition.java
index 7d2b818..fef9c5b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessDefinition.java
@@ -32,7 +32,7 @@ import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.ObjectHelper;
 
 /**
- * Calls a Camel processor.
+ * Calls a Camel processor
  *
  * @version 
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
index 53821ff..efaf03e 100644
--- a/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java
@@ -56,7 +56,7 @@ import static org.apache.camel.util.CamelContextHelper.findByType;
 import static org.apache.camel.util.CamelContextHelper.lookup;
 
 /**
- * Remote service call definition
+ * To call remote services
  */
 @Metadata(label = "eip,routing")
 @XmlRootElement(name = "serviceCall")

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-dsl-eip.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-dsl-eip.adoc b/components/camel-scala/src/main/docs/scala-dsl-eip.adoc
deleted file mode 100644
index f8d52e6..0000000
--- a/components/camel-scala/src/main/docs/scala-dsl-eip.adoc
+++ /dev/null
@@ -1,224 +0,0 @@
-[[ScalaDSL-SupportedDSL]]
-Scala Supported DSL
-^^^^^^^^^^^^^^^^^^^
-
-The link:scala-dsl.html[Scala DSL] supports *every* DSL from the
-link:dsl.html[Java DSL].
-
-On this page we have examples for a number of the link:eip.html[EIP]s. +
- You can check the
-https://svn.apache.org/repos/asf/camel/trunk/components/camel-scala/src/test/scala/[unit
-test source code] for the Scala Component to find more examples.
-
-* 1 link:#ScalaDSL-EIP-Messagingsystems[Messaging systems]
-** 1.1 link:#ScalaDSL-EIP-Pipelinepipeline[Pipeline]
-** 1.2 link:#ScalaDSL-EIP-Filterfilter[Filter]
-* 2 link:#ScalaDSL-EIP-Messagingchannels[Messaging channels]
-** 2.1 link:#ScalaDSL-EIP-Deadletterchannel[Dead letter channel]
-* 3 link:#ScalaDSL-EIP-Messagerouting[Message routing]
-** 3.1 link:#ScalaDSL-EIP-Aggregator[Aggregator]
-** 3.2 link:#ScalaDSL-EIP-Contentbasedrouter[Content based router]
-** 3.3 link:#ScalaDSL-EIP-Delayer[Delayer]
-** 3.4 link:#ScalaDSL-EIP-Loadbalancer[Load balancer]
-** 3.5 link:#ScalaDSL-EIP-Multicast[Multicast]
-** 3.6 link:#ScalaDSL-EIP-Recipientlist[Recipient list]
-** 3.7 link:#ScalaDSL-EIP-Resequencer[Resequencer]
-** 3.8 link:#ScalaDSL-EIP-Splitter[Splitter]
-** 3.9 link:#ScalaDSL-EIP-Throttler[Throttler]
-* 4 link:#ScalaDSL-EIP-Messagetransformation[Message transformation]
-** 4.1 link:#ScalaDSL-EIP-Contentenricher[Content enricher]
-
-[[ScalaDSL-EIP-Messagingsystems]]
-Messaging systems
-^^^^^^^^^^^^^^^^^
-
-[[ScalaDSL-EIP-Pipelinepipeline]]
-Pipeline
-++++++++
-
-There is a simple syntax available for specifying pipeline, by simple
-putting `to` or `\u2192` between the different steps in the pipeline.
-
-For more advanced use cases, you can also use a block-based syntax,
-where every step in the pipeline starts with either `to` or `\u2192`.
-
-[[ScalaDSL-EIP-Filterfilter]]
-Filter
-++++++
-
-For a message filter, use the `when()` method with a parameter of type
-The `Exchange \u21d2 Boolean`. In the example below, we use a Scala
-convenience method named `in` to access the 'in' message body; only
-messages where the 'in' message is `<hello/>` will arrive at the
-`mock:a` endpoint.
-
-Once again, if you need to specify a more advanced route, you can use
-the more elaborate syntax.
-
-[[ScalaDSL-EIP-Messagingchannels]]
-Messaging channels
-^^^^^^^^^^^^^^^^^^
-
-[[ScalaDSL-EIP-Deadletterchannel]]
-Dead letter channel
-+++++++++++++++++++
-
-The http://www.eaipatterns.com/DeadLetterChannel.html[dead letter
-channel] can be created with the syntax similar to the one used in
-http://camel.apache.org/dead-letter-channel.html[Java DSL].
-
-[source,java]
-------------------------------------------------------------------
-"jms:in" errorHandler(deadLetterChannel("jms:error")) to "jms:out"
-------------------------------------------------------------------
-
-You can also use different error handler available for the
-http://camel.apache.org/error-handler.html[Java DSL]. In particular
-Scala DSL supports
-http://camel.apache.org/defaulterrorhandler.html[DefaultErrorHandler]
-and
-http://camel.apache.org/error-handler.html#ErrorHandler-LoggingErrorHandler[LoggingErrorHandler].
-
-[source,java]
-----------------------------------------------------------------------------------------------------------------
-// DefaultErrorHandler
-"jms:in" errorHandler(defaultErrorHandler) to "jms:out"
-
-// LoggingErrorHandler
-"jms:in" errorHandler(loggingErrorHandler.level(LoggingLevel.INFO).logName("com.example.MyLogger")) to "jms:out"
-----------------------------------------------------------------------------------------------------------------
-
-[[ScalaDSL-EIP-Messagerouting]]
-Message routing
-^^^^^^^^^^^^^^^
-
-[[ScalaDSL-EIP-Aggregator]]
-Aggregator
-++++++++++
-
-The aggregator EIP aggregates messages based on some message correlation
-criteria. In the Scala DSL, the `aggregate` method takes a function
-`Exchange \u21d2 Any` to determine the correlation value for the exchange. In
-the sample below, message are being aggregated if the first 7 letters in
-the message body are the same.
-
-[[ScalaDSL-EIP-Contentbasedrouter]]
-Content based router
-++++++++++++++++++++
-
-Similar to the link:scala-dsl-eip.html[Filter], the content based router
-uses `when` methods with `Exchange \u21d2 Boolean` function literals and an
-optional `otherwise`. The function literal can contain plain Scala code
-as well as any of the link:scala-dsl-supported-languages.html[supported
-languages]. The example below routes a given message based on the
-language of the message body.
-
-[[ScalaDSL-EIP-Delayer]]
-Delayer
-+++++++
-
-Unlike a throttler, which only slows down messages if the rate exceeds a
-treshold, a delayer delays every messages with a fixed amount of time.
-An example: to delay every message going from `seda:a` to `mock:a` with
-1 second, you write...
-
-Our second example will delay the entire block (containing `mock:c`)
-without doing anything to `mock:b`
-
-[[ScalaDSL-EIP-Loadbalancer]]
-Load balancer
-+++++++++++++
-
-To distribute the message handling load over multiple endpoints, we add
-a `loadbalance` to our route definition. You can optionally specify a
-load balancer strategy, like `roundrobin`
-
-[[ScalaDSL-EIP-Multicast]]
-Multicast
-+++++++++
-
-Multicast allows you to send a message to multiple endpoints at the same
-time. In a simple route, you can specify multiple targets in the `to` or
-`\u2192` method call:
-
-[[ScalaDSL-EIP-Recipientlist]]
-Recipient list
-++++++++++++++
-
-You can handle a static recipient list with a multicast or
-link:scala-dsl-eip.html[pipeline], but this EIP is usually applied when
-you want to dynamically determine the name(s) of the next endpoint(s) to
-route to. Use the `recipients()` method with a function literal
-(`Exchange => Any`) that returns the endpoint name(s). In the example
-below, the target endpoint name can be found in the String message
-starting at position 21.
-
-Because the `recipients()` method just takes a function literal, you can
-basically use any kind of valid Scala code to determine the endpoint
-name. Have a look at the next example which uses pattern matching to
-figure out where to send the message:
-
-Again, we can also use the same thing in a more block-like syntax. For
-this example, we use the Scala DSL's
-link:scala-dsl-supported-languages.html[support for JXPath] to determine
-the target.
-
-[[ScalaDSL-EIP-Resequencer]]
-Resequencer
-+++++++++++
-
-Use the `resequence` method to add a resequencer to the RouteBuilder.
-The method takes a function (`Exchange \u21d2 Unit`) that determines the
-value to resequence on. In this example, we resequence messages based on
-the 'in' message body.
-
-The same EIP can also be used with a block-like syntax...
-
-... and with configurable batch size. In this last example, messages
-will be send to `mock:e` whenever a batch of 5 messages is available.
-
-[[ScalaDSL-EIP-Splitter]]
-Splitter
-++++++++
-
-To handle large message in smaller chunks, you can write a Scala
-`Exchange \u21d2 Any*` method and add it to your route with the `splitter`
-method. As with many other EIPs, we support a short, in-line version as
-well as a more elaborate block based one.
-
-The above examples also show you how
-link:scala-dsl-supported-languages.html[other languages] like XPath can
-be within the Scala DSL.
-
-[[ScalaDSL-EIP-Throttler]]
-Throttler
-+++++++++
-
-The throttler allows you to slow down messages before sending them
-along. The `throttle` methods allows you to specify the maximum
-throughput rate of message:
-
-It can also be used in front of block to throttle messages at that
-point. In the example below, message are passed on to `mock:b` in a
-normal rate (i.e. as fast as possible), but a maximum 3 messages/2
-seconds will arrive at the `mock:c` endpoint.
-
-[[ScalaDSL-EIP-Messagetransformation]]
-Message transformation
-^^^^^^^^^^^^^^^^^^^^^^
-
-[[ScalaDSL-EIP-Contentenricher]]
-Content enricher
-++++++++++++++++
-
-Using a processor function (`Exchange \u2192 Unit`), you can alter/enrich the
-message content. This example uses a simple function literal to append
-`" says Hello"` to the message content:
-
-However, you can also define a separate method/function to handle the
-transformation and pass that to the `process` method instead. The
-example below uses pattern matching to enrich the message content:
-
-Off course, you can also use any other Camel component (e.g.
-link:velocity.html[Velocity]) to enrich the content and add it to a
-pipeline

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-dsl-getting-started.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-dsl-getting-started.adoc b/components/camel-scala/src/main/docs/scala-dsl-getting-started.adoc
deleted file mode 100644
index 21cc41d..0000000
--- a/components/camel-scala/src/main/docs/scala-dsl-getting-started.adoc
+++ /dev/null
@@ -1,59 +0,0 @@
-[[ScalaDSL-GettingStarted]]
-Scala DSL Getting Started
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Just like the link:dsl.html[Java DSL], the Scala DSL has a RouteBuilder
-class (`org.apache.camel.scala.dsl.builder.RouteBuilder`) that you can
-extend to implement your own routes. This example shows two very simple
-routes:
-
-INFO: From *Camel 2.15* onwards use
-org.apache.camel.scala.dsl.builder.ScalaRouteBuilder and pass in the
-CamelContext in the constructor, which will be used by the builder. The
-old class RouteBuilder is deprecated.
-
-If you compare this to the Java link:dsl.html[DSL], you notice:
-
-* there is no configure() method to override
-* a route starts directly with a URI instead of `from(uri)`
-* `\u2192` is just an alias for `to`
-
-[[ScalaDSL-GettingStarted-SettingtherouteID]]
-Setting the route ID
-^^^^^^^^^^^^^^^^^^^^
-
-To assign the unique ID to the Scala route, insert the `routeId` method
-invocation after the "from" part of the DSL.
-
-[source,java]
------------------------------------------
- "direct:a" routeId "route-b" to "mock:b"
------------------------------------------
-
-[[ScalaDSL-GettingStarted-CreatinganewCamelScalaproject]]
-Creating a new Camel Scala project
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Camel offers link:camel-maven-archetypes.html[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):
-
-[source,java]
-----------------------
-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:
-
-[source,java]
----------------------
-mvn compile exec:java
----------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-dsl-supported-languages.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-dsl-supported-languages.adoc b/components/camel-scala/src/main/docs/scala-dsl-supported-languages.adoc
deleted file mode 100644
index bbdb72a..0000000
--- a/components/camel-scala/src/main/docs/scala-dsl-supported-languages.adoc
+++ /dev/null
@@ -1,30 +0,0 @@
-[[ScalaDSL-SupportedLanguages]]
-Scala DSL Supported Languages
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-Support for link:languages.html[other languages] inside the Scala DSL
-routes is delivered through traits. The
-`org.apache.camel.scala.dsl.languages` package currently offers traits
-to support XPath. To use any given language, you can mix-in the trait
-when creating your `RouteBuilder`.
-
-You can use any of the supported Camel link:languages.html[Languages] in
-the link:scala-dsl.html[Scala DSL]; see below for a couple of examples:
-
-[[ScalaDSL-Supportedlanguages-Using]]
-Using link:xpath.html[XPath]
-++++++++++++++++++++++++++++
-
-With the XPath trait, you have an additional method available on an
-`Exchange` to do XPath queries against the message. Just look at this
-Splitter example, where the `xpath` method is used in a
-`Exchange \u21d2 Any*` function literal
-
-[[ScalaDSL-Supportedlanguages-Using.1]]
-Using link:jxpath.html[JXPath]
-++++++++++++++++++++++++++++++
-
-With the `org.apache.camel.scala.dsl.languages.JXPath` trait, you can an
-additional `jxpath` method on the `Exchange`. In the Recipient List
-example below, JXPath is used for getting the next endpoint's name out
-of the message body.

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-dsl.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-dsl.adoc b/components/camel-scala/src/main/docs/scala-dsl.adoc
deleted file mode 100644
index 7c2b54a..0000000
--- a/components/camel-scala/src/main/docs/scala-dsl.adoc
+++ /dev/null
@@ -1,76 +0,0 @@
-[[ScalaDSL-AbouttheScalaDSL]]
-About the Scala DSL
-^^^^^^^^^^^^^^^^^^^
-
-http://www.scala-lang.org/[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 link:dsl.html[DSL], but it adds Scala syntax sugar to make
-building routes even more convenient.
-
-[[ScalaDSL-Documentation]]
-Documentation
-^^^^^^^^^^^^^
-
-* link:scala-dsl-getting-started.html[Scala DSL - Getting Started] gives
-you basic information on how to use the Scala DSL.
-* link:scala-dsl-eip.html[Scala DSL - EIP] shows you the Scala DSL
-syntax for every EIP supported. link:scala-dsl.html[Scala DSL] supports
-every EIP from the link:dsl.html[Java DSL].
-* link:scala-dsl-supported-languages.html[Scala DSL - Supported
-languages] explains the usage of traits to add support for other
-languages (e.g. XPath)
-
-[[ScalaDSL-References]]
-References
-^^^^^^^^^^
-
-* At http://www.eu.apachecon.com[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.
-http://www.anova.be/files/camel-scala.pdf[Here are the presentation
-slides] .
-* Here's a
-http://davsclaus.blogspot.se/2011/12/apache-camel-little-scala-dsl-example.html[blog
-post] demonstrating the link:message-filter.html[Message Filter] EIP
-within the link:scala-dsl.html[Scala DSL], as well as how to use
-link:camel-test.html[Camel's test kit] to test the example.
-
-[[ScalaDSL-Dependencies]]
-Dependencies
-^^^^^^^^^^^^
-
-To use the Scala DSL in your camel routes you need to add the a
-dependency on *camel-scala* which implements the Scala DSL.
-
-If you use maven you could just add the following to your pom.xml,
-substituting the version number for the latest & greatest release (see
-the download page for the latest versions).
-
-[source,xml]
-----------------------------------------------------------
-<dependency>
-  <groupId>org.apache.camel</groupId>
-  <artifactId>camel-scala</artifactId>
-  <version>x.x.x</version>
-  <!-- use the same version as your Camel core version -->
-</dependency>
-----------------------------------------------------------
-
-Starting from version 2.11 Camel Scala DSL is compiled against Scala
-2.10. If you plan to use Scala 2.9 with Camel 2.11, add the following to
-your pom.xml file instead.
-
-[source,xml]
-----------------------------------------------------------
-<dependency>
-  <groupId>org.apache.camel</groupId>
-  <artifactId>camel-scala_2.9</artifactId>
-  <version>2.11.x</version>
-  <!-- use the same version as your Camel core version -->
-</dependency>
-----------------------------------------------------------
-
-Support for Scala 2.9 is deprecated and will be removed starting from
-the Camel 2.12 and 3.0.

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-eip.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-eip.adoc b/components/camel-scala/src/main/docs/scala-eip.adoc
new file mode 100644
index 0000000..f8d52e6
--- /dev/null
+++ b/components/camel-scala/src/main/docs/scala-eip.adoc
@@ -0,0 +1,224 @@
+[[ScalaDSL-SupportedDSL]]
+Scala Supported DSL
+^^^^^^^^^^^^^^^^^^^
+
+The link:scala-dsl.html[Scala DSL] supports *every* DSL from the
+link:dsl.html[Java DSL].
+
+On this page we have examples for a number of the link:eip.html[EIP]s. +
+ You can check the
+https://svn.apache.org/repos/asf/camel/trunk/components/camel-scala/src/test/scala/[unit
+test source code] for the Scala Component to find more examples.
+
+* 1 link:#ScalaDSL-EIP-Messagingsystems[Messaging systems]
+** 1.1 link:#ScalaDSL-EIP-Pipelinepipeline[Pipeline]
+** 1.2 link:#ScalaDSL-EIP-Filterfilter[Filter]
+* 2 link:#ScalaDSL-EIP-Messagingchannels[Messaging channels]
+** 2.1 link:#ScalaDSL-EIP-Deadletterchannel[Dead letter channel]
+* 3 link:#ScalaDSL-EIP-Messagerouting[Message routing]
+** 3.1 link:#ScalaDSL-EIP-Aggregator[Aggregator]
+** 3.2 link:#ScalaDSL-EIP-Contentbasedrouter[Content based router]
+** 3.3 link:#ScalaDSL-EIP-Delayer[Delayer]
+** 3.4 link:#ScalaDSL-EIP-Loadbalancer[Load balancer]
+** 3.5 link:#ScalaDSL-EIP-Multicast[Multicast]
+** 3.6 link:#ScalaDSL-EIP-Recipientlist[Recipient list]
+** 3.7 link:#ScalaDSL-EIP-Resequencer[Resequencer]
+** 3.8 link:#ScalaDSL-EIP-Splitter[Splitter]
+** 3.9 link:#ScalaDSL-EIP-Throttler[Throttler]
+* 4 link:#ScalaDSL-EIP-Messagetransformation[Message transformation]
+** 4.1 link:#ScalaDSL-EIP-Contentenricher[Content enricher]
+
+[[ScalaDSL-EIP-Messagingsystems]]
+Messaging systems
+^^^^^^^^^^^^^^^^^
+
+[[ScalaDSL-EIP-Pipelinepipeline]]
+Pipeline
+++++++++
+
+There is a simple syntax available for specifying pipeline, by simple
+putting `to` or `\u2192` between the different steps in the pipeline.
+
+For more advanced use cases, you can also use a block-based syntax,
+where every step in the pipeline starts with either `to` or `\u2192`.
+
+[[ScalaDSL-EIP-Filterfilter]]
+Filter
+++++++
+
+For a message filter, use the `when()` method with a parameter of type
+The `Exchange \u21d2 Boolean`. In the example below, we use a Scala
+convenience method named `in` to access the 'in' message body; only
+messages where the 'in' message is `<hello/>` will arrive at the
+`mock:a` endpoint.
+
+Once again, if you need to specify a more advanced route, you can use
+the more elaborate syntax.
+
+[[ScalaDSL-EIP-Messagingchannels]]
+Messaging channels
+^^^^^^^^^^^^^^^^^^
+
+[[ScalaDSL-EIP-Deadletterchannel]]
+Dead letter channel
++++++++++++++++++++
+
+The http://www.eaipatterns.com/DeadLetterChannel.html[dead letter
+channel] can be created with the syntax similar to the one used in
+http://camel.apache.org/dead-letter-channel.html[Java DSL].
+
+[source,java]
+------------------------------------------------------------------
+"jms:in" errorHandler(deadLetterChannel("jms:error")) to "jms:out"
+------------------------------------------------------------------
+
+You can also use different error handler available for the
+http://camel.apache.org/error-handler.html[Java DSL]. In particular
+Scala DSL supports
+http://camel.apache.org/defaulterrorhandler.html[DefaultErrorHandler]
+and
+http://camel.apache.org/error-handler.html#ErrorHandler-LoggingErrorHandler[LoggingErrorHandler].
+
+[source,java]
+----------------------------------------------------------------------------------------------------------------
+// DefaultErrorHandler
+"jms:in" errorHandler(defaultErrorHandler) to "jms:out"
+
+// LoggingErrorHandler
+"jms:in" errorHandler(loggingErrorHandler.level(LoggingLevel.INFO).logName("com.example.MyLogger")) to "jms:out"
+----------------------------------------------------------------------------------------------------------------
+
+[[ScalaDSL-EIP-Messagerouting]]
+Message routing
+^^^^^^^^^^^^^^^
+
+[[ScalaDSL-EIP-Aggregator]]
+Aggregator
+++++++++++
+
+The aggregator EIP aggregates messages based on some message correlation
+criteria. In the Scala DSL, the `aggregate` method takes a function
+`Exchange \u21d2 Any` to determine the correlation value for the exchange. In
+the sample below, message are being aggregated if the first 7 letters in
+the message body are the same.
+
+[[ScalaDSL-EIP-Contentbasedrouter]]
+Content based router
+++++++++++++++++++++
+
+Similar to the link:scala-dsl-eip.html[Filter], the content based router
+uses `when` methods with `Exchange \u21d2 Boolean` function literals and an
+optional `otherwise`. The function literal can contain plain Scala code
+as well as any of the link:scala-dsl-supported-languages.html[supported
+languages]. The example below routes a given message based on the
+language of the message body.
+
+[[ScalaDSL-EIP-Delayer]]
+Delayer
++++++++
+
+Unlike a throttler, which only slows down messages if the rate exceeds a
+treshold, a delayer delays every messages with a fixed amount of time.
+An example: to delay every message going from `seda:a` to `mock:a` with
+1 second, you write...
+
+Our second example will delay the entire block (containing `mock:c`)
+without doing anything to `mock:b`
+
+[[ScalaDSL-EIP-Loadbalancer]]
+Load balancer
++++++++++++++
+
+To distribute the message handling load over multiple endpoints, we add
+a `loadbalance` to our route definition. You can optionally specify a
+load balancer strategy, like `roundrobin`
+
+[[ScalaDSL-EIP-Multicast]]
+Multicast
++++++++++
+
+Multicast allows you to send a message to multiple endpoints at the same
+time. In a simple route, you can specify multiple targets in the `to` or
+`\u2192` method call:
+
+[[ScalaDSL-EIP-Recipientlist]]
+Recipient list
+++++++++++++++
+
+You can handle a static recipient list with a multicast or
+link:scala-dsl-eip.html[pipeline], but this EIP is usually applied when
+you want to dynamically determine the name(s) of the next endpoint(s) to
+route to. Use the `recipients()` method with a function literal
+(`Exchange => Any`) that returns the endpoint name(s). In the example
+below, the target endpoint name can be found in the String message
+starting at position 21.
+
+Because the `recipients()` method just takes a function literal, you can
+basically use any kind of valid Scala code to determine the endpoint
+name. Have a look at the next example which uses pattern matching to
+figure out where to send the message:
+
+Again, we can also use the same thing in a more block-like syntax. For
+this example, we use the Scala DSL's
+link:scala-dsl-supported-languages.html[support for JXPath] to determine
+the target.
+
+[[ScalaDSL-EIP-Resequencer]]
+Resequencer
++++++++++++
+
+Use the `resequence` method to add a resequencer to the RouteBuilder.
+The method takes a function (`Exchange \u21d2 Unit`) that determines the
+value to resequence on. In this example, we resequence messages based on
+the 'in' message body.
+
+The same EIP can also be used with a block-like syntax...
+
+... and with configurable batch size. In this last example, messages
+will be send to `mock:e` whenever a batch of 5 messages is available.
+
+[[ScalaDSL-EIP-Splitter]]
+Splitter
+++++++++
+
+To handle large message in smaller chunks, you can write a Scala
+`Exchange \u21d2 Any*` method and add it to your route with the `splitter`
+method. As with many other EIPs, we support a short, in-line version as
+well as a more elaborate block based one.
+
+The above examples also show you how
+link:scala-dsl-supported-languages.html[other languages] like XPath can
+be within the Scala DSL.
+
+[[ScalaDSL-EIP-Throttler]]
+Throttler
++++++++++
+
+The throttler allows you to slow down messages before sending them
+along. The `throttle` methods allows you to specify the maximum
+throughput rate of message:
+
+It can also be used in front of block to throttle messages at that
+point. In the example below, message are passed on to `mock:b` in a
+normal rate (i.e. as fast as possible), but a maximum 3 messages/2
+seconds will arrive at the `mock:c` endpoint.
+
+[[ScalaDSL-EIP-Messagetransformation]]
+Message transformation
+^^^^^^^^^^^^^^^^^^^^^^
+
+[[ScalaDSL-EIP-Contentenricher]]
+Content enricher
+++++++++++++++++
+
+Using a processor function (`Exchange \u2192 Unit`), you can alter/enrich the
+message content. This example uses a simple function literal to append
+`" says Hello"` to the message content:
+
+However, you can also define a separate method/function to handle the
+transformation and pass that to the `process` method instead. The
+example below uses pattern matching to enrich the message content:
+
+Off course, you can also use any other Camel component (e.g.
+link:velocity.html[Velocity]) to enrich the content and add it to a
+pipeline

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-getting-started.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-getting-started.adoc b/components/camel-scala/src/main/docs/scala-getting-started.adoc
new file mode 100644
index 0000000..21cc41d
--- /dev/null
+++ b/components/camel-scala/src/main/docs/scala-getting-started.adoc
@@ -0,0 +1,59 @@
+[[ScalaDSL-GettingStarted]]
+Scala DSL Getting Started
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Just like the link:dsl.html[Java DSL], the Scala DSL has a RouteBuilder
+class (`org.apache.camel.scala.dsl.builder.RouteBuilder`) that you can
+extend to implement your own routes. This example shows two very simple
+routes:
+
+INFO: From *Camel 2.15* onwards use
+org.apache.camel.scala.dsl.builder.ScalaRouteBuilder and pass in the
+CamelContext in the constructor, which will be used by the builder. The
+old class RouteBuilder is deprecated.
+
+If you compare this to the Java link:dsl.html[DSL], you notice:
+
+* there is no configure() method to override
+* a route starts directly with a URI instead of `from(uri)`
+* `\u2192` is just an alias for `to`
+
+[[ScalaDSL-GettingStarted-SettingtherouteID]]
+Setting the route ID
+^^^^^^^^^^^^^^^^^^^^
+
+To assign the unique ID to the Scala route, insert the `routeId` method
+invocation after the "from" part of the DSL.
+
+[source,java]
+-----------------------------------------
+ "direct:a" routeId "route-b" to "mock:b"
+-----------------------------------------
+
+[[ScalaDSL-GettingStarted-CreatinganewCamelScalaproject]]
+Creating a new Camel Scala project
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Camel offers link:camel-maven-archetypes.html[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):
+
+[source,java]
+----------------------
+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:
+
+[source,java]
+---------------------
+mvn compile exec:java
+---------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala-supported-languages.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala-supported-languages.adoc b/components/camel-scala/src/main/docs/scala-supported-languages.adoc
new file mode 100644
index 0000000..bbdb72a
--- /dev/null
+++ b/components/camel-scala/src/main/docs/scala-supported-languages.adoc
@@ -0,0 +1,30 @@
+[[ScalaDSL-SupportedLanguages]]
+Scala DSL Supported Languages
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Support for link:languages.html[other languages] inside the Scala DSL
+routes is delivered through traits. The
+`org.apache.camel.scala.dsl.languages` package currently offers traits
+to support XPath. To use any given language, you can mix-in the trait
+when creating your `RouteBuilder`.
+
+You can use any of the supported Camel link:languages.html[Languages] in
+the link:scala-dsl.html[Scala DSL]; see below for a couple of examples:
+
+[[ScalaDSL-Supportedlanguages-Using]]
+Using link:xpath.html[XPath]
+++++++++++++++++++++++++++++
+
+With the XPath trait, you have an additional method available on an
+`Exchange` to do XPath queries against the message. Just look at this
+Splitter example, where the `xpath` method is used in a
+`Exchange \u21d2 Any*` function literal
+
+[[ScalaDSL-Supportedlanguages-Using.1]]
+Using link:jxpath.html[JXPath]
+++++++++++++++++++++++++++++++
+
+With the `org.apache.camel.scala.dsl.languages.JXPath` trait, you can an
+additional `jxpath` method on the `Exchange`. In the Recipient List
+example below, JXPath is used for getting the next endpoint's name out
+of the message body.

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/camel-scala/src/main/docs/scala.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scala/src/main/docs/scala.adoc b/components/camel-scala/src/main/docs/scala.adoc
new file mode 100644
index 0000000..a026489
--- /dev/null
+++ b/components/camel-scala/src/main/docs/scala.adoc
@@ -0,0 +1,78 @@
+[[ScalaDSL-AbouttheScalaDSL]]
+About the Scala DSL
+^^^^^^^^^^^^^^^^^^^
+
+**Deprecated**
+
+http://www.scala-lang.org/[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 link:dsl.html[DSL], but it adds Scala syntax sugar to make
+building routes even more convenient.
+
+[[ScalaDSL-Documentation]]
+Documentation
+^^^^^^^^^^^^^
+
+* link:scala-dsl-getting-started.html[Scala DSL - Getting Started] gives
+you basic information on how to use the Scala DSL.
+* link:scala-dsl-eip.html[Scala DSL - EIP] shows you the Scala DSL
+syntax for every EIP supported. link:scala-dsl.html[Scala DSL] supports
+every EIP from the link:dsl.html[Java DSL].
+* link:scala-dsl-supported-languages.html[Scala DSL - Supported
+languages] explains the usage of traits to add support for other
+languages (e.g. XPath)
+
+[[ScalaDSL-References]]
+References
+^^^^^^^^^^
+
+* At http://www.eu.apachecon.com[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.
+http://www.anova.be/files/camel-scala.pdf[Here are the presentation
+slides] .
+* Here's a
+http://davsclaus.blogspot.se/2011/12/apache-camel-little-scala-dsl-example.html[blog
+post] demonstrating the link:message-filter.html[Message Filter] EIP
+within the link:scala-dsl.html[Scala DSL], as well as how to use
+link:camel-test.html[Camel's test kit] to test the example.
+
+[[ScalaDSL-Dependencies]]
+Dependencies
+^^^^^^^^^^^^
+
+To use the Scala DSL in your camel routes you need to add the a
+dependency on *camel-scala* which implements the Scala DSL.
+
+If you use maven you could just add the following to your pom.xml,
+substituting the version number for the latest & greatest release (see
+the download page for the latest versions).
+
+[source,xml]
+----------------------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-scala</artifactId>
+  <version>x.x.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----------------------------------------------------------
+
+Starting from version 2.11 Camel Scala DSL is compiled against Scala
+2.10. If you plan to use Scala 2.9 with Camel 2.11, add the following to
+your pom.xml file instead.
+
+[source,xml]
+----------------------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-scala_2.9</artifactId>
+  <version>2.11.x</version>
+  <!-- use the same version as your Camel core version -->
+</dependency>
+----------------------------------------------------------
+
+Support for Scala 2.9 is deprecated and will be removed starting from
+the Camel 2.12 and 3.0.

http://git-wip-us.apache.org/repos/asf/camel/blob/26f1e959/components/readme.adoc
----------------------------------------------------------------------
diff --git a/components/readme.adoc b/components/readme.adoc
index a8dbd0a..b68822d 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -390,7 +390,7 @@ Number of Components: 231 in 184 JAR artifacts (14 deprecated)
 `metrics:metricsType:metricsName` | 2.14 | To collect various metrics directly from Camel routes using the DropWizard metrics library.
 
 | link:camel-milo/src/main/docs/milo-client-component.adoc[Milo based OPC UA Client] (camel-milo) +
-`milo-client:tcp://user:password@host:port/path/to/service` |  | Camel OPC UA support
+`milo-client:endpointUri` | 2.19 | Camel OPC UA support
 
 | link:camel-mina/src/main/docs/mina-component.adoc[Mina] (camel-mina) +
 `mina:protocol:host:port` | 1.0 | *deprecated* Socket level networking using TCP or UDP with the Apache Mina 1.x library.
@@ -453,7 +453,7 @@ Number of Components: 231 in 184 JAR artifacts (14 deprecated)
 `olingo4:apiName/methodName` | 2.19 | Communicates with OData 4.0 services using Apache Olingo OData API.
 
 | link:camel-milo/src/main/docs/milo-server-component.adoc[OPC UA Server] (camel-milo) +
-`milo-server:itemId` |  | OPC UA Server based endpoint
+`milo-server:itemId` | 2.19 | OPC UA Server based endpoint
 
 | link:camel-openshift/src/main/docs/openshift-component.adoc[OpenShift] (camel-openshift) +
 `openshift:clientId` | 2.14 | *deprecated* To manage your Openshift 2.x applications.


[2/2] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/81f7515e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/81f7515e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/81f7515e

Branch: refs/heads/master
Commit: 81f7515e545f3ffde83d61a0b52629951f67c233
Parents: 26f1e95
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 13 10:55:52 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 13 10:55:52 2017 +0200

----------------------------------------------------------------------
 .../camel-scr/src/main/docs/camel-and-scr.adoc  | 653 ------------------
 components/camel-scr/src/main/docs/scr.adoc     | 655 +++++++++++++++++++
 2 files changed, 655 insertions(+), 653 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/81f7515e/components/camel-scr/src/main/docs/camel-and-scr.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scr/src/main/docs/camel-and-scr.adoc b/components/camel-scr/src/main/docs/camel-and-scr.adoc
deleted file mode 100644
index b4cfe39..0000000
--- a/components/camel-scr/src/main/docs/camel-and-scr.adoc
+++ /dev/null
@@ -1,653 +0,0 @@
-## Working with Camel and SCR
-
-SCR stands for Service Component Runtime and is an implementation of
-OSGi Declarative Services specification. SCR enables any plain old Java
-object to expose and use OSGi services with no boilerplate code.
-
-OSGi framework knows your object by looking at SCR descriptor files in
-its bundle which are typically generated from Java annotations by a
-plugin such as `org.apache.felix:maven-scr-plugin`.
-
-Running Camel in an SCR bundle is a great alternative for Spring DM and
-Blueprint based solutions having significantly fewer lines of code
-between you and the OSGi framework. Using SCR your bundle can remain
-completely in Java world; there is no need to edit XML or properties
-files. This offers you full control over everything and means your IDE
-of choice knows exactly what is going on in your project.
-
-### Camel SCR support
-
-INFO: *Available as of Camel 2.15.0*. 
-Camel-scr bundle is not included in Apache Camel versions prior 2.15.0,
-but the artifact itself can be used with any Camel version since 2.12.0.
-
-`org.apache.camel/camel-scr` bundle provides a base class,
-`AbstractCamelRunner`, which manages a Camel context for you and a
-helper class, `ScrHelper`, for using your SCR properties in unit tests.
-Camel-scr feature for Apache Karaf�defines all features and bundles
-required for running Camel in SCR bundles.
-
-`AbstractCamelRunner`�class ties CamelContext's lifecycle to Service
-Component's lifecycle and handles configuration with help of Camel's
-PropertiesComponent. All you have to do to make a Service Component out
-of your java class is to extend it from `AbstractCamelRunner`�and add
-the following `org.apache.felix.scr.annotations` on class level:
-
-*Add required annotations*
-
-[source,java]
----------------------------------------------------------------------------------------------------------------
-@Component
-@References({
-    @Reference(name = "camelComponent",referenceInterface = ComponentResolver.class,
-        cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy = ReferencePolicy.DYNAMIC,
-        policyOption = ReferencePolicyOption.GREEDY, bind = "gotCamelComponent", unbind = "lostCamelComponent")
-})
----------------------------------------------------------------------------------------------------------------
-
-Then implement `getRouteBuilders()` method which returns the Camel
-routes you want to run:
-
-*Implement getRouteBuilders()*
-
-[source,java]
-------------------------------------------------------------------
-    @Override
-    protected List<RoutesBuilder> getRouteBuilders() {
-        List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        routesBuilders.add(new YourRouteBuilderHere(registry));
-        routesBuilders.add(new AnotherRouteBuilderHere(registry));
-        return routesBuilders;
-    }
-------------------------------------------------------------------
-
-And finally provide the default configuration with:
-
-*Default configuration in annotations*
-
-[source,java]
----------------------------------------------------------
-@Properties({
-   @Property(name = "camelContextId", value = "my-test"),
-   @Property(name = "active", value = "true"),
-   @Property(name = "...", value = "..."),
-   ...
-})
----------------------------------------------------------
-
-�
-
-That's all. And if you used `camel-archetype-scr` to generate a project
-all this is already taken care of.
-
-Below is an example of a complete Service Component class, generated by
-`camel-archetype-scr:`
-
-*CamelScrExample.java*
-
-[source,java]
--------------------------------------------------------------------------------------------------------------------------------------------
-// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
-package example;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.scr.AbstractCamelRunner;
-import example.internal.CamelScrExampleRoute;
-import org.apache.camel.RoutesBuilder;
-import org.apache.camel.spi.ComponentResolver;
-import org.apache.felix.scr.annotations.*;
-
-@Component(label = CamelScrExample.COMPONENT_LABEL, description = CamelScrExample.COMPONENT_DESCRIPTION, immediate = true, metatype = true)
-@Properties({
-    @Property(name = "camelContextId", value = "camel-scr-example"),
-    @Property(name = "camelRouteId", value = "foo/timer-log"),
-    @Property(name = "active", value = "true"),
-    @Property(name = "from", value = "timer:foo?period=5000"),
-    @Property(name = "to", value = "log:foo?showHeaders=true"),
-    @Property(name = "messageOk", value = "Success: {{from}} -> {{to}}"),
-    @Property(name = "messageError", value = "Failure: {{from}} -> {{to}}"),
-    @Property(name = "maximumRedeliveries", value = "0"),
-    @Property(name = "redeliveryDelay", value = "5000"),
-    @Property(name = "backOffMultiplier", value = "2"),
-    @Property(name = "maximumRedeliveryDelay", value = "60000")
-})
-@References({
-    @Reference(name = "camelComponent",referenceInterface = ComponentResolver.class,
-        cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy = ReferencePolicy.DYNAMIC,
-        policyOption = ReferencePolicyOption.GREEDY, bind = "gotCamelComponent", unbind = "lostCamelComponent")
-})
-public class CamelScrExample extends AbstractCamelRunner {
-
-    public static final String COMPONENT_LABEL = "example.CamelScrExample";
-    public static final String COMPONENT_DESCRIPTION = "This is the description for camel-scr-example.";
-
-    @Override
-    protected List<RoutesBuilder> getRouteBuilders() {
-        List<RoutesBuilder> routesBuilders = new ArrayList<>();
-        routesBuilders.add(new CamelScrExampleRoute(registry));
-        return routesBuilders;
-    }
-}
--------------------------------------------------------------------------------------------------------------------------------------------
-
-�
-
-`CamelContextId`�and `active`�properties control the CamelContext's name
-(defaults to "camel-runner-default") and whether it will be started or
-not (defaults to "false"), respectively. In addition to these you can
-add and use as many properties as you like. Camel's PropertiesComponent
-handles recursive properties and prefixing with fallback without
-problem.
-
-`AbstractCamelRunner`�will make these properties available to your
-RouteBuilders with help of Camel's PropertiesComponent and it will also
-inject these values into your Service Component's and RouteBuilder's
-fields when their names match. The fields can be declared with any
-visibility level, and many types are supported (String, int, boolean,
-URL, ...).
-
-Below is an example of a RouteBuilder class generated by
-`camel-archetype-scr`:
-
-�
-
-*CamelScrExampleRoute.java*
-
-[source,java]
------------------------------------------------------------------------------------------------
-// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
-package example.internal;
-
-import org.apache.camel.LoggingLevel;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.SimpleRegistry;
-import org.apache.commons.lang.Validate;
-
-public class CamelScrExampleRoute extends RouteBuilder {
-
-    SimpleRegistry registry;
-
-    // Configured fields
-    private String camelRouteId;
-    private Integer maximumRedeliveries;
-    private Long redeliveryDelay;
-    private Double backOffMultiplier;
-    private Long maximumRedeliveryDelay;
-
-    public CamelScrExampleRoute(final SimpleRegistry registry) {
-        this.registry = registry;
-    }
-
-    @Override
-    public void configure() throws Exception {
-        checkProperties();
-
-        // Add a bean to Camel context registry
-        registry.put("test", "bean");
-
-        errorHandler(defaultErrorHandler()
-            .retryAttemptedLogLevel(LoggingLevel.WARN)
-            .maximumRedeliveries(maximumRedeliveries)
-            .redeliveryDelay(redeliveryDelay)
-            .backOffMultiplier(backOffMultiplier)
-            .maximumRedeliveryDelay(maximumRedeliveryDelay));
-
-        from("{{from}}")
-            .startupOrder(2)
-            .routeId(camelRouteId)
-            .onCompletion()
-                .to("direct:processCompletion")
-            .end()
-            .removeHeaders("CamelHttp*")
-            .to("{{to}}");
-
-
-        from("direct:processCompletion")
-            .startupOrder(1)
-            .routeId(camelRouteId + ".completion")
-            .choice()
-                .when(simple("${exception} == null"))
-                    .log("{{messageOk}}")
-                .otherwise()
-                    .log(LoggingLevel.ERROR, "{{messageError}}")
-            .end();
-        }
-    }
-
-    public void checkProperties() {
-        Validate.notNull(camelRouteId, "camelRouteId property is not set");
-        Validate.notNull(maximumRedeliveries, "maximumRedeliveries property is not set");
-        Validate.notNull(redeliveryDelay, "redeliveryDelay property is not set");
-        Validate.notNull(backOffMultiplier, "backOffMultiplier property is not set");
-        Validate.notNull(maximumRedeliveryDelay, "maximumRedeliveryDelay property is not set");
-    }
-}
------------------------------------------------------------------------------------------------
-
-�
-
-Let's take a look at `CamelScrExampleRoute` in more detail.
-
-�
-
-[source,java]
-----------------------------------------
-    // Configured fields
-    private String camelRouteId;
-    private Integer maximumRedeliveries;
-    private Long redeliveryDelay;
-    private Double backOffMultiplier;
-    private Long maximumRedeliveryDelay;
-----------------------------------------
-
-The values of these fields are set with values from properties by
-matching their names.
-
-�
-
-[source,java]
------------------------------------------------
-        // Add a bean to Camel context registry
-        registry.put("test", "bean");
------------------------------------------------
-
-If you need to add some beans to CamelContext's registry for your
-routes, you can do it like this.
-
-�
-
-[source,java]
------------------------------------------------------------------------------------------------
-    public void checkProperties() {
-        Validate.notNull(camelRouteId, "camelRouteId property is not set");
-        Validate.notNull(maximumRedeliveries, "maximumRedeliveries property is not set");
-        Validate.notNull(redeliveryDelay, "redeliveryDelay property is not set");
-        Validate.notNull(backOffMultiplier, "backOffMultiplier property is not set");
-        Validate.notNull(maximumRedeliveryDelay, "maximumRedeliveryDelay property is not set");
-    }
------------------------------------------------------------------------------------------------
-
-It is a good idea to check that required parameters are set and they
-have meaningful values before allowing the routes to start.
-
-�
-
-[source,java]
-----------------------------------------------------------------
-        from("{{from}}")
-            .startupOrder(2)
-            .routeId(camelRouteId)
-            .onCompletion()
-                .to("direct:processCompletion")
-            .end()
-            .removeHeaders("CamelHttp*")
-            .to("{{to}}");
-
-
-        from("direct:processCompletion")
-            .startupOrder(1)
-            .routeId(camelRouteId + ".completion")
-            .choice()
-                .when(simple("${exception} == null"))
-                    .log("{{messageOk}}")
-                .otherwise()
-                    .log(LoggingLevel.ERROR, "{{messageError}}")
-            .end();
-----------------------------------------------------------------
-
-Note that pretty much everything in the route is configured with
-properties. This essentially makes your RouteBuilder a template. SCR
-allows you to create more instances of your routes just by providing
-alternative configurations. More on this in section _Using Camel SCR
-bundle as a template_.
-
-### AbstractCamelRunner's lifecycle in SCR
-
-1.  When component's configuration policy and mandatory references are
-satisfied SCR calls `activate()`. This creates and sets up a
-CamelContext through the following call chain:
-`activate()`�\u2192�`prepare()`�\u2192�`createCamelContext()`
-\u2192�`setupPropertiesComponent()` \u2192�`configure()` \u2192�`setupCamelContext()`.
-Finally, the context is scheduled to start after a delay defined in
-`AbstractCamelRunner.START_DELAY`�with `runWithDelay()`.
-2.  When Camel components (`ComponentResolver` services, to be exact)
-are registered in OSGi, SCR calls `gotCamelComponent``()` which
-reschedules/delays the CamelContext start further by the same
-`AbstractCamelRunner.START_DELAY`. This in effect makes CamelContext
-wait until all Camel components are loaded or there is a sufficient gap
-between them. The same logic will tell a failed-to-start CamelContext to
-try again whenever we add more Camel components.
-3.  When Camel components are unregistered SCR calls
-`lostCamelComponent``()`. This call does nothing.
-4.  When one of the requirements that caused the call to `activate``()`
-is lost SCR will call `deactivate``()`. This will shutdown the
-CamelContext.
-
-In (non-OSGi) unit tests you should use `prepare()` \u2192�`run()` \u2192�`stop()`
-instead of `activate()` \u2192�`deactivate()` for more fine-grained control.
-Also, this allows us to avoid possible SCR specific operations in tests.
-
-### Using camel-archetype-scr
-
-The easiest way to create an Camel SCR bundle project is to use
-`camel-archetype-scr`�and Maven.
-
-You can generate a project with the following steps:
-
-*Generating a project*
-
-[source,text]
---------------------------------------------------------------------------------------------------------------
-$ mvn archetype:generate -Dfilter=org.apache.camel.archetypes:camel-archetype-scr
-�
-Choose archetype:
-1: local -> org.apache.camel.archetypes:camel-archetype-scr (Creates a new Camel SCR bundle project for Karaf)
-Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
-Define value for property 'groupId': : example
-[INFO] Using property: groupId = example
-Define value for property 'artifactId': : camel-scr-example
-Define value for property 'version': 1.0-SNAPSHOT: :
-Define value for property 'package': example: :
-[INFO] Using property: archetypeArtifactId = camel-archetype-scr
-[INFO] Using property: archetypeGroupId = org.apache.camel.archetypes
-[INFO] Using property: archetypeVersion = 2.15-SNAPSHOT
-Define value for property 'className': : CamelScrExample
-Confirm properties configuration:
-groupId: example
-artifactId: camel-scr-example
-version: 1.0-SNAPSHOT
-package: example
-archetypeArtifactId: camel-archetype-scr
-archetypeGroupId: org.apache.camel.archetypes
-archetypeVersion: 2.15-SNAPSHOT
-className: CamelScrExample
-Y: :
---------------------------------------------------------------------------------------------------------------
-
-Done!
-
-Now run:
-
-[source,java]
------------
-mvn install
------------
-
-and the bundle is ready to be deployed.
-
-### Unit testing Camel routes
-
-Service Component is a POJO and has no special requirements for
-(non-OSGi) unit testing. There are however some techniques that are
-specific to Camel SCR or just make testing easier.
-
-Below is an example unit test, generated by `camel-archetype-scr`:
-
-[source,java]
-------------------------------------------------------------------------------------------------------
-// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
-package example;
-
-import java.util.List;
-
-import org.apache.camel.scr.internal.ScrHelper;
-import org.apache.camel.builder.AdviceWithRouteBuilder;
-import org.apache.camel.component.mock.MockComponent;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.model.ModelCamelContext;
-import org.apache.camel.model.RouteDefinition;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class CamelScrExampleTest {
-
-    Logger log = LoggerFactory.getLogger(getClass());
-
-    @Rule
-    public TestName testName = new TestName();
-
-    CamelScrExample integration;
-    ModelCamelContext context;
-
-    @Before
-    public void setUp() throws Exception {
-        log.info("*******************************************************************");
-        log.info("Test: " + testName.getMethodName());
-        log.info("*******************************************************************");
-
-        // Set property prefix for unit testing
-        System.setProperty(CamelScrExample.PROPERTY_PREFIX, "unit");
-
-        // Prepare the integration
-        integration = new CamelScrExample();
-        integration.prepare(null, ScrHelper.getScrProperties(integration.getClass().getName()));
-        context = integration.getContext();
-
-        // Disable JMX for test
-        context.disableJMX();
-
-        // Fake a component for test
-        context.addComponent("amq", new MockComponent());
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        integration.stop();
-    }
-
-    @Test
-    public void testRoutes() throws Exception {
-        // Adjust routes
-        List<RouteDefinition> routes = context.getRouteDefinitions();
-
-        routes.get(0).adviceWith(context, new AdviceWithRouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                // Replace "from" endpoint with direct:start
-                replaceFromWith("direct:start");
-                // Mock and skip result endpoint
-                mockEndpoints("log:*");
-            }
-        });
-
-        MockEndpoint resultEndpoint = context.getEndpoint("mock:log:foo", MockEndpoint.class);
-        // resultEndpoint.expectedMessageCount(1); // If you want to just check the number of messages
-        resultEndpoint.expectedBodiesReceived("hello"); // If you want to check the contents
-
-        // Start the integration
-        integration.run();
-
-        // Send the test message
-        context.createProducerTemplate().sendBody("direct:start", "hello");
-
-        resultEndpoint.assertIsSatisfied();
-    }
-}
-------------------------------------------------------------------------------------------------------
-
-�
-
-Now, let's take a look at the interesting bits one by one.
-
-*Using property prefixing*
-
-[source,java]
---------------------------------------------------------------------
-        // Set property prefix for unit testing
-        System.setProperty(CamelScrExample.PROPERTY_PREFIX, "unit");
---------------------------------------------------------------------
-
-This allows you to override parts of the configuration by prefixing
-properties with "unit.". For example, `unit.from` overrides `from` for
-the unit test.
-
-Prefixes can be used to handle the differences between the runtime
-environments where your routes might run. Moving the unchanged bundle
-through development, testing and production environments is a typical
-use case.
-
-�
-
-*Getting test configuration from annotations*
-
-[source,java]
-------------------------------------------------------------------------------------------------
-        integration.prepare(null, ScrHelper.getScrProperties(integration.getClass().getName()));
-------------------------------------------------------------------------------------------------
-
-Here we configure the Service Component in test with the same properties
-that would be used in OSGi environment.
-
-�
-
-*Mocking components for test*
-
-[source,java]
----------------------------------------------------------
-        // Fake a component for test
-        context.addComponent("amq", new MockComponent());
----------------------------------------------------------
-
-Components that are not available in test can be mocked like this to
-allow the route to start.
-
-�
-
-*Adjusting routes for test*
-
-[source,java]
-------------------------------------------------------------------------
-        // Adjust routes
-        List<RouteDefinition> routes = context.getRouteDefinitions();
-
-        routes.get(0).adviceWith(context, new AdviceWithRouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                // Replace "from" endpoint with direct:start
-                replaceFromWith("direct:start");
-                // Mock and skip result endpoint
-                mockEndpoints("log:*");
-            }
-        });
-------------------------------------------------------------------------
-
-Camel's AdviceWith feature allows routes to be modified for test.
-
-�
-
-*Starting the routes*
-
-[source,java]
---------------------------------
-        // Start the integration
-        integration.run();
---------------------------------
-
-Here we start the Service Component and along with it the routes.
-
-�
-
-*Sending a test message*
-
-[source,java]
----------------------------------------------------------------------------
-        // Send the test message
-        context.createProducerTemplate().sendBody("direct:start", "hello");
----------------------------------------------------------------------------
-
-Here we send a message to a route in test.
-
-### Running the bundle in Apache Karaf
-
-Once the bundle has been built with `mvn install` it's ready to be
-deployed.�To deploy the bundle on Apache Karaf perform the following
-steps on Karaf command line:
-
-*Deploying the bundle in Apache Karaf*
-
-[source,text]
-------------------------------------------------------------------------
-# Add Camel feature repository
-karaf@root> features:chooseurl camel 2.15-SNAPSHOT
-�
-# Install camel-scr feature
-karaf@root> features:install camel-scr
-�
-# Install commons-lang, used in the example route to validate parameters
-karaf@root> osgi:install mvn:commons-lang/commons-lang/2.6
-�
-# Install and start your bundle
-karaf@root> osgi:install -s mvn:example/camel-scr-example/1.0-SNAPSHOT
-�
-# See how it's running
-karaf@root> log:tail -n 10
-�
-Press ctrl-c to stop watching the log.
-------------------------------------------------------------------------
-
-#### Overriding the default configuration
-
-By default, Service Component's configuration PID equals the fully
-qualified name of its class. You can change the example bundle's
-properties with Karaf's�`config:*` commands:
-
-*Override a property*
-
-[source,text]
-----------------------------------------------------------------------------------------
-# Override 'messageOk' property
-karaf@root> config:propset -p example.CamelScrExample messageOk "This is better logging"
-----------------------------------------------------------------------------------------
-
-Or you can change the configuration by editing property files in Karaf's
-`etc` folder.
-
-#### Using Camel SCR bundle as a template
-
-Let's say you have a Camel SCR bundle that implements an integration
-pattern that you use frequently, say, *from \u2192�to*, with success/failure
-logging and redelivery which also happens to be the pattern our example
-route implements. You probably don't want to create a separate bundle
-for every instance. No worries, SCR has you covered.
-
-Create a configuration PID for your Service Component, but add a tail
-with a dash and SCR will use that configuration to create a new instance
-of your component.
-
-*Creating a new Service Component instance*
-
-[source,text]
-------------------------------------------------------------------------
-# Create a PID with a tail
-karaf@root> config:edit example.CamelScrExample-anotherone
-�
-# Override some properties
-karaf@root> config:propset camelContextId my-other-context
-karaf@root> config:propset to "file://removeme?fileName=removemetoo.txt"
-�
-# Save the PID
-karaf@root> config:update
-------------------------------------------------------------------------
-
-This will start a new CamelContext with your overridden properties. How
-convenient.
-
-### Notes
-
-When designing a Service Component to be a template you typically don't
-want it to start without a "tailed" configuration i.e. with the default
-configuration.
-
-To prevent your Service Component from starting with the default
-configuration add `policy = ConfigurationPolicy.REQUIRE `to the class
-level `@Component` annotation.

http://git-wip-us.apache.org/repos/asf/camel/blob/81f7515e/components/camel-scr/src/main/docs/scr.adoc
----------------------------------------------------------------------
diff --git a/components/camel-scr/src/main/docs/scr.adoc b/components/camel-scr/src/main/docs/scr.adoc
new file mode 100644
index 0000000..451af6a
--- /dev/null
+++ b/components/camel-scr/src/main/docs/scr.adoc
@@ -0,0 +1,655 @@
+## Working with Camel and SCR
+
+**deprecated**
+
+SCR stands for Service Component Runtime and is an implementation of
+OSGi Declarative Services specification. SCR enables any plain old Java
+object to expose and use OSGi services with no boilerplate code.
+
+OSGi framework knows your object by looking at SCR descriptor files in
+its bundle which are typically generated from Java annotations by a
+plugin such as `org.apache.felix:maven-scr-plugin`.
+
+Running Camel in an SCR bundle is a great alternative for Spring DM and
+Blueprint based solutions having significantly fewer lines of code
+between you and the OSGi framework. Using SCR your bundle can remain
+completely in Java world; there is no need to edit XML or properties
+files. This offers you full control over everything and means your IDE
+of choice knows exactly what is going on in your project.
+
+### Camel SCR support
+
+INFO: *Available as of Camel 2.15.0*. 
+Camel-scr bundle is not included in Apache Camel versions prior 2.15.0,
+but the artifact itself can be used with any Camel version since 2.12.0.
+
+`org.apache.camel/camel-scr` bundle provides a base class,
+`AbstractCamelRunner`, which manages a Camel context for you and a
+helper class, `ScrHelper`, for using your SCR properties in unit tests.
+Camel-scr feature for Apache Karaf�defines all features and bundles
+required for running Camel in SCR bundles.
+
+`AbstractCamelRunner`�class ties CamelContext's lifecycle to Service
+Component's lifecycle and handles configuration with help of Camel's
+PropertiesComponent. All you have to do to make a Service Component out
+of your java class is to extend it from `AbstractCamelRunner`�and add
+the following `org.apache.felix.scr.annotations` on class level:
+
+*Add required annotations*
+
+[source,java]
+---------------------------------------------------------------------------------------------------------------
+@Component
+@References({
+    @Reference(name = "camelComponent",referenceInterface = ComponentResolver.class,
+        cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy = ReferencePolicy.DYNAMIC,
+        policyOption = ReferencePolicyOption.GREEDY, bind = "gotCamelComponent", unbind = "lostCamelComponent")
+})
+---------------------------------------------------------------------------------------------------------------
+
+Then implement `getRouteBuilders()` method which returns the Camel
+routes you want to run:
+
+*Implement getRouteBuilders()*
+
+[source,java]
+------------------------------------------------------------------
+    @Override
+    protected List<RoutesBuilder> getRouteBuilders() {
+        List<RoutesBuilder> routesBuilders = new ArrayList<>();
+        routesBuilders.add(new YourRouteBuilderHere(registry));
+        routesBuilders.add(new AnotherRouteBuilderHere(registry));
+        return routesBuilders;
+    }
+------------------------------------------------------------------
+
+And finally provide the default configuration with:
+
+*Default configuration in annotations*
+
+[source,java]
+---------------------------------------------------------
+@Properties({
+   @Property(name = "camelContextId", value = "my-test"),
+   @Property(name = "active", value = "true"),
+   @Property(name = "...", value = "..."),
+   ...
+})
+---------------------------------------------------------
+
+�
+
+That's all. And if you used `camel-archetype-scr` to generate a project
+all this is already taken care of.
+
+Below is an example of a complete Service Component class, generated by
+`camel-archetype-scr:`
+
+*CamelScrExample.java*
+
+[source,java]
+-------------------------------------------------------------------------------------------------------------------------------------------
+// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
+package example;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.scr.AbstractCamelRunner;
+import example.internal.CamelScrExampleRoute;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.spi.ComponentResolver;
+import org.apache.felix.scr.annotations.*;
+
+@Component(label = CamelScrExample.COMPONENT_LABEL, description = CamelScrExample.COMPONENT_DESCRIPTION, immediate = true, metatype = true)
+@Properties({
+    @Property(name = "camelContextId", value = "camel-scr-example"),
+    @Property(name = "camelRouteId", value = "foo/timer-log"),
+    @Property(name = "active", value = "true"),
+    @Property(name = "from", value = "timer:foo?period=5000"),
+    @Property(name = "to", value = "log:foo?showHeaders=true"),
+    @Property(name = "messageOk", value = "Success: {{from}} -> {{to}}"),
+    @Property(name = "messageError", value = "Failure: {{from}} -> {{to}}"),
+    @Property(name = "maximumRedeliveries", value = "0"),
+    @Property(name = "redeliveryDelay", value = "5000"),
+    @Property(name = "backOffMultiplier", value = "2"),
+    @Property(name = "maximumRedeliveryDelay", value = "60000")
+})
+@References({
+    @Reference(name = "camelComponent",referenceInterface = ComponentResolver.class,
+        cardinality = ReferenceCardinality.MANDATORY_MULTIPLE, policy = ReferencePolicy.DYNAMIC,
+        policyOption = ReferencePolicyOption.GREEDY, bind = "gotCamelComponent", unbind = "lostCamelComponent")
+})
+public class CamelScrExample extends AbstractCamelRunner {
+
+    public static final String COMPONENT_LABEL = "example.CamelScrExample";
+    public static final String COMPONENT_DESCRIPTION = "This is the description for camel-scr-example.";
+
+    @Override
+    protected List<RoutesBuilder> getRouteBuilders() {
+        List<RoutesBuilder> routesBuilders = new ArrayList<>();
+        routesBuilders.add(new CamelScrExampleRoute(registry));
+        return routesBuilders;
+    }
+}
+-------------------------------------------------------------------------------------------------------------------------------------------
+
+�
+
+`CamelContextId`�and `active`�properties control the CamelContext's name
+(defaults to "camel-runner-default") and whether it will be started or
+not (defaults to "false"), respectively. In addition to these you can
+add and use as many properties as you like. Camel's PropertiesComponent
+handles recursive properties and prefixing with fallback without
+problem.
+
+`AbstractCamelRunner`�will make these properties available to your
+RouteBuilders with help of Camel's PropertiesComponent and it will also
+inject these values into your Service Component's and RouteBuilder's
+fields when their names match. The fields can be declared with any
+visibility level, and many types are supported (String, int, boolean,
+URL, ...).
+
+Below is an example of a RouteBuilder class generated by
+`camel-archetype-scr`:
+
+�
+
+*CamelScrExampleRoute.java*
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
+package example.internal;
+
+import org.apache.camel.LoggingLevel;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.SimpleRegistry;
+import org.apache.commons.lang.Validate;
+
+public class CamelScrExampleRoute extends RouteBuilder {
+
+    SimpleRegistry registry;
+
+    // Configured fields
+    private String camelRouteId;
+    private Integer maximumRedeliveries;
+    private Long redeliveryDelay;
+    private Double backOffMultiplier;
+    private Long maximumRedeliveryDelay;
+
+    public CamelScrExampleRoute(final SimpleRegistry registry) {
+        this.registry = registry;
+    }
+
+    @Override
+    public void configure() throws Exception {
+        checkProperties();
+
+        // Add a bean to Camel context registry
+        registry.put("test", "bean");
+
+        errorHandler(defaultErrorHandler()
+            .retryAttemptedLogLevel(LoggingLevel.WARN)
+            .maximumRedeliveries(maximumRedeliveries)
+            .redeliveryDelay(redeliveryDelay)
+            .backOffMultiplier(backOffMultiplier)
+            .maximumRedeliveryDelay(maximumRedeliveryDelay));
+
+        from("{{from}}")
+            .startupOrder(2)
+            .routeId(camelRouteId)
+            .onCompletion()
+                .to("direct:processCompletion")
+            .end()
+            .removeHeaders("CamelHttp*")
+            .to("{{to}}");
+
+
+        from("direct:processCompletion")
+            .startupOrder(1)
+            .routeId(camelRouteId + ".completion")
+            .choice()
+                .when(simple("${exception} == null"))
+                    .log("{{messageOk}}")
+                .otherwise()
+                    .log(LoggingLevel.ERROR, "{{messageError}}")
+            .end();
+        }
+    }
+
+    public void checkProperties() {
+        Validate.notNull(camelRouteId, "camelRouteId property is not set");
+        Validate.notNull(maximumRedeliveries, "maximumRedeliveries property is not set");
+        Validate.notNull(redeliveryDelay, "redeliveryDelay property is not set");
+        Validate.notNull(backOffMultiplier, "backOffMultiplier property is not set");
+        Validate.notNull(maximumRedeliveryDelay, "maximumRedeliveryDelay property is not set");
+    }
+}
+-----------------------------------------------------------------------------------------------
+
+�
+
+Let's take a look at `CamelScrExampleRoute` in more detail.
+
+�
+
+[source,java]
+----------------------------------------
+    // Configured fields
+    private String camelRouteId;
+    private Integer maximumRedeliveries;
+    private Long redeliveryDelay;
+    private Double backOffMultiplier;
+    private Long maximumRedeliveryDelay;
+----------------------------------------
+
+The values of these fields are set with values from properties by
+matching their names.
+
+�
+
+[source,java]
+-----------------------------------------------
+        // Add a bean to Camel context registry
+        registry.put("test", "bean");
+-----------------------------------------------
+
+If you need to add some beans to CamelContext's registry for your
+routes, you can do it like this.
+
+�
+
+[source,java]
+-----------------------------------------------------------------------------------------------
+    public void checkProperties() {
+        Validate.notNull(camelRouteId, "camelRouteId property is not set");
+        Validate.notNull(maximumRedeliveries, "maximumRedeliveries property is not set");
+        Validate.notNull(redeliveryDelay, "redeliveryDelay property is not set");
+        Validate.notNull(backOffMultiplier, "backOffMultiplier property is not set");
+        Validate.notNull(maximumRedeliveryDelay, "maximumRedeliveryDelay property is not set");
+    }
+-----------------------------------------------------------------------------------------------
+
+It is a good idea to check that required parameters are set and they
+have meaningful values before allowing the routes to start.
+
+�
+
+[source,java]
+----------------------------------------------------------------
+        from("{{from}}")
+            .startupOrder(2)
+            .routeId(camelRouteId)
+            .onCompletion()
+                .to("direct:processCompletion")
+            .end()
+            .removeHeaders("CamelHttp*")
+            .to("{{to}}");
+
+
+        from("direct:processCompletion")
+            .startupOrder(1)
+            .routeId(camelRouteId + ".completion")
+            .choice()
+                .when(simple("${exception} == null"))
+                    .log("{{messageOk}}")
+                .otherwise()
+                    .log(LoggingLevel.ERROR, "{{messageError}}")
+            .end();
+----------------------------------------------------------------
+
+Note that pretty much everything in the route is configured with
+properties. This essentially makes your RouteBuilder a template. SCR
+allows you to create more instances of your routes just by providing
+alternative configurations. More on this in section _Using Camel SCR
+bundle as a template_.
+
+### AbstractCamelRunner's lifecycle in SCR
+
+1.  When component's configuration policy and mandatory references are
+satisfied SCR calls `activate()`. This creates and sets up a
+CamelContext through the following call chain:
+`activate()`�\u2192�`prepare()`�\u2192�`createCamelContext()`
+\u2192�`setupPropertiesComponent()` \u2192�`configure()` \u2192�`setupCamelContext()`.
+Finally, the context is scheduled to start after a delay defined in
+`AbstractCamelRunner.START_DELAY`�with `runWithDelay()`.
+2.  When Camel components (`ComponentResolver` services, to be exact)
+are registered in OSGi, SCR calls `gotCamelComponent``()` which
+reschedules/delays the CamelContext start further by the same
+`AbstractCamelRunner.START_DELAY`. This in effect makes CamelContext
+wait until all Camel components are loaded or there is a sufficient gap
+between them. The same logic will tell a failed-to-start CamelContext to
+try again whenever we add more Camel components.
+3.  When Camel components are unregistered SCR calls
+`lostCamelComponent``()`. This call does nothing.
+4.  When one of the requirements that caused the call to `activate``()`
+is lost SCR will call `deactivate``()`. This will shutdown the
+CamelContext.
+
+In (non-OSGi) unit tests you should use `prepare()` \u2192�`run()` \u2192�`stop()`
+instead of `activate()` \u2192�`deactivate()` for more fine-grained control.
+Also, this allows us to avoid possible SCR specific operations in tests.
+
+### Using camel-archetype-scr
+
+The easiest way to create an Camel SCR bundle project is to use
+`camel-archetype-scr`�and Maven.
+
+You can generate a project with the following steps:
+
+*Generating a project*
+
+[source,text]
+--------------------------------------------------------------------------------------------------------------
+$ mvn archetype:generate -Dfilter=org.apache.camel.archetypes:camel-archetype-scr
+�
+Choose archetype:
+1: local -> org.apache.camel.archetypes:camel-archetype-scr (Creates a new Camel SCR bundle project for Karaf)
+Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
+Define value for property 'groupId': : example
+[INFO] Using property: groupId = example
+Define value for property 'artifactId': : camel-scr-example
+Define value for property 'version': 1.0-SNAPSHOT: :
+Define value for property 'package': example: :
+[INFO] Using property: archetypeArtifactId = camel-archetype-scr
+[INFO] Using property: archetypeGroupId = org.apache.camel.archetypes
+[INFO] Using property: archetypeVersion = 2.15-SNAPSHOT
+Define value for property 'className': : CamelScrExample
+Confirm properties configuration:
+groupId: example
+artifactId: camel-scr-example
+version: 1.0-SNAPSHOT
+package: example
+archetypeArtifactId: camel-archetype-scr
+archetypeGroupId: org.apache.camel.archetypes
+archetypeVersion: 2.15-SNAPSHOT
+className: CamelScrExample
+Y: :
+--------------------------------------------------------------------------------------------------------------
+
+Done!
+
+Now run:
+
+[source,java]
+-----------
+mvn install
+-----------
+
+and the bundle is ready to be deployed.
+
+### Unit testing Camel routes
+
+Service Component is a POJO and has no special requirements for
+(non-OSGi) unit testing. There are however some techniques that are
+specific to Camel SCR or just make testing easier.
+
+Below is an example unit test, generated by `camel-archetype-scr`:
+
+[source,java]
+------------------------------------------------------------------------------------------------------
+// This file was generated from org.apache.camel.archetypes/camel-archetype-scr/2.15-SNAPSHOT
+package example;
+
+import java.util.List;
+
+import org.apache.camel.scr.internal.ScrHelper;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.component.mock.MockComponent;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class CamelScrExampleTest {
+
+    Logger log = LoggerFactory.getLogger(getClass());
+
+    @Rule
+    public TestName testName = new TestName();
+
+    CamelScrExample integration;
+    ModelCamelContext context;
+
+    @Before
+    public void setUp() throws Exception {
+        log.info("*******************************************************************");
+        log.info("Test: " + testName.getMethodName());
+        log.info("*******************************************************************");
+
+        // Set property prefix for unit testing
+        System.setProperty(CamelScrExample.PROPERTY_PREFIX, "unit");
+
+        // Prepare the integration
+        integration = new CamelScrExample();
+        integration.prepare(null, ScrHelper.getScrProperties(integration.getClass().getName()));
+        context = integration.getContext();
+
+        // Disable JMX for test
+        context.disableJMX();
+
+        // Fake a component for test
+        context.addComponent("amq", new MockComponent());
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        integration.stop();
+    }
+
+    @Test
+    public void testRoutes() throws Exception {
+        // Adjust routes
+        List<RouteDefinition> routes = context.getRouteDefinitions();
+
+        routes.get(0).adviceWith(context, new AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // Replace "from" endpoint with direct:start
+                replaceFromWith("direct:start");
+                // Mock and skip result endpoint
+                mockEndpoints("log:*");
+            }
+        });
+
+        MockEndpoint resultEndpoint = context.getEndpoint("mock:log:foo", MockEndpoint.class);
+        // resultEndpoint.expectedMessageCount(1); // If you want to just check the number of messages
+        resultEndpoint.expectedBodiesReceived("hello"); // If you want to check the contents
+
+        // Start the integration
+        integration.run();
+
+        // Send the test message
+        context.createProducerTemplate().sendBody("direct:start", "hello");
+
+        resultEndpoint.assertIsSatisfied();
+    }
+}
+------------------------------------------------------------------------------------------------------
+
+�
+
+Now, let's take a look at the interesting bits one by one.
+
+*Using property prefixing*
+
+[source,java]
+--------------------------------------------------------------------
+        // Set property prefix for unit testing
+        System.setProperty(CamelScrExample.PROPERTY_PREFIX, "unit");
+--------------------------------------------------------------------
+
+This allows you to override parts of the configuration by prefixing
+properties with "unit.". For example, `unit.from` overrides `from` for
+the unit test.
+
+Prefixes can be used to handle the differences between the runtime
+environments where your routes might run. Moving the unchanged bundle
+through development, testing and production environments is a typical
+use case.
+
+�
+
+*Getting test configuration from annotations*
+
+[source,java]
+------------------------------------------------------------------------------------------------
+        integration.prepare(null, ScrHelper.getScrProperties(integration.getClass().getName()));
+------------------------------------------------------------------------------------------------
+
+Here we configure the Service Component in test with the same properties
+that would be used in OSGi environment.
+
+�
+
+*Mocking components for test*
+
+[source,java]
+---------------------------------------------------------
+        // Fake a component for test
+        context.addComponent("amq", new MockComponent());
+---------------------------------------------------------
+
+Components that are not available in test can be mocked like this to
+allow the route to start.
+
+�
+
+*Adjusting routes for test*
+
+[source,java]
+------------------------------------------------------------------------
+        // Adjust routes
+        List<RouteDefinition> routes = context.getRouteDefinitions();
+
+        routes.get(0).adviceWith(context, new AdviceWithRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // Replace "from" endpoint with direct:start
+                replaceFromWith("direct:start");
+                // Mock and skip result endpoint
+                mockEndpoints("log:*");
+            }
+        });
+------------------------------------------------------------------------
+
+Camel's AdviceWith feature allows routes to be modified for test.
+
+�
+
+*Starting the routes*
+
+[source,java]
+--------------------------------
+        // Start the integration
+        integration.run();
+--------------------------------
+
+Here we start the Service Component and along with it the routes.
+
+�
+
+*Sending a test message*
+
+[source,java]
+---------------------------------------------------------------------------
+        // Send the test message
+        context.createProducerTemplate().sendBody("direct:start", "hello");
+---------------------------------------------------------------------------
+
+Here we send a message to a route in test.
+
+### Running the bundle in Apache Karaf
+
+Once the bundle has been built with `mvn install` it's ready to be
+deployed.�To deploy the bundle on Apache Karaf perform the following
+steps on Karaf command line:
+
+*Deploying the bundle in Apache Karaf*
+
+[source,text]
+------------------------------------------------------------------------
+# Add Camel feature repository
+karaf@root> features:chooseurl camel 2.15-SNAPSHOT
+�
+# Install camel-scr feature
+karaf@root> features:install camel-scr
+�
+# Install commons-lang, used in the example route to validate parameters
+karaf@root> osgi:install mvn:commons-lang/commons-lang/2.6
+�
+# Install and start your bundle
+karaf@root> osgi:install -s mvn:example/camel-scr-example/1.0-SNAPSHOT
+�
+# See how it's running
+karaf@root> log:tail -n 10
+�
+Press ctrl-c to stop watching the log.
+------------------------------------------------------------------------
+
+#### Overriding the default configuration
+
+By default, Service Component's configuration PID equals the fully
+qualified name of its class. You can change the example bundle's
+properties with Karaf's�`config:*` commands:
+
+*Override a property*
+
+[source,text]
+----------------------------------------------------------------------------------------
+# Override 'messageOk' property
+karaf@root> config:propset -p example.CamelScrExample messageOk "This is better logging"
+----------------------------------------------------------------------------------------
+
+Or you can change the configuration by editing property files in Karaf's
+`etc` folder.
+
+#### Using Camel SCR bundle as a template
+
+Let's say you have a Camel SCR bundle that implements an integration
+pattern that you use frequently, say, *from \u2192�to*, with success/failure
+logging and redelivery which also happens to be the pattern our example
+route implements. You probably don't want to create a separate bundle
+for every instance. No worries, SCR has you covered.
+
+Create a configuration PID for your Service Component, but add a tail
+with a dash and SCR will use that configuration to create a new instance
+of your component.
+
+*Creating a new Service Component instance*
+
+[source,text]
+------------------------------------------------------------------------
+# Create a PID with a tail
+karaf@root> config:edit example.CamelScrExample-anotherone
+�
+# Override some properties
+karaf@root> config:propset camelContextId my-other-context
+karaf@root> config:propset to "file://removeme?fileName=removemetoo.txt"
+�
+# Save the PID
+karaf@root> config:update
+------------------------------------------------------------------------
+
+This will start a new CamelContext with your overridden properties. How
+convenient.
+
+### Notes
+
+When designing a Service Component to be a template you typically don't
+want it to start without a "tailed" configuration i.e. with the default
+configuration.
+
+To prevent your Service Component from starting with the default
+configuration add `policy = ConfigurationPolicy.REQUIRE `to the class
+level `@Component` annotation.