You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/07/31 09:56:59 UTC

[1/6] camel git commit: Added error-handler docs to Gitbook

Repository: camel
Updated Branches:
  refs/heads/master ffb006008 -> bd6f1d284


Added error-handler docs to Gitbook


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

Branch: refs/heads/master
Commit: 3002f8d3effb0bbaf6a0a1bd33f9ac1b474fa968
Parents: ffb0060
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:08:56 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:08:56 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md         |   3 +-
 docs/user-manual/en/error-handler.adoc | 390 ++++++++++++++++++++++++++++
 2 files changed, 391 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3002f8d3/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index d621211..0ecc6f4 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -30,6 +30,7 @@
             * [Scala DSL Supported Languages](scala-dsl-supported-languages.adoc)
         * [Annotation DSL](bean-integration.adoc)
     * [Endpoint](endpoint.adoc)
+    * [Error Handler](error-handler.adoc)
     * [Exchange](exchange.adoc)
     * [Exchange Pattern](exchange-pattern.adoc)
     * [Intercept](intercept.adoc)
@@ -38,8 +39,6 @@
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Camel-Core](camel-core.adoc)
-    * [Error Handler](.adoc)
     * [Expression](.adoc)
     * [Injector](.adoc)
     * [Inversion Of Control With Smart Defaults](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/3002f8d3/docs/user-manual/en/error-handler.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/error-handler.adoc b/docs/user-manual/en/error-handler.adoc
new file mode 100644
index 0000000..b9e4281
--- /dev/null
+++ b/docs/user-manual/en/error-handler.adoc
@@ -0,0 +1,390 @@
+[[ErrorHandler-ErrorHandler]]
+Error Handler
+~~~~~~~~~~~~~
+
+Camel supports pluggable
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/ErrorHandler.html[ErrorHandler]
+strategies to deal with errors processing an
+link:event-driven-consumer.html[Event Driven Consumer]. An alternative
+is to specify the error handling directly in the link:dsl.html[DSL]
+using the link:exception-clause.html[Exception Clause].
+
+For introduction and background material see
+link:error-handling-in-camel.html[Error handling in Camel].
+
+*Exception Clause*
+
+Using link:error-handler.html[Error Handler] combined with
+link:exception-clause.html[Exception Clause] is a very powerful
+combination. We encourage end-users to use this combination in your
+error handling strategies. See samples and
+link:exception-clause.html[Exception Clause].
+
+*Using try ... catch ... finally*
+
+Related to error handling is the link:try-catch-finally.html[Try Catch
+Finally] as DSL you can use directly in your route. Its basically a
+mimic of the regular try catch finally in the Java language but with
+more power.
+
+The current implementations Camel provides out of the box are:
+
+[[ErrorHandler-Nontransacted]]
+Non transacted
+++++++++++++++
+
+* link:defaulterrorhandler.html[DefaultErrorHandler] is the default
+error handler in Camel. This error handler does not support a dead
+letter queue, it will propagate exceptions back to the caller, as if
+there where no error handler at all. It has a limited set of features.
+* link:dead-letter-channel.html[Dead Letter Channel] which supports
+attempting to redeliver the message exchange a number of times before
+sending it to a dead letter endpoint
+* LoggingErrorHandler for just catching and logging exceptions
+* NoErrorHandler for no error handling
+
+[[ErrorHandler-Transacted]]
+Transacted
+++++++++++
+
+* link:transactionerrorhandler.html[TransactionErrorHandler] is the
+default error handler in Camel for transacted routes. See the
+link:transactional-client.html[Transactional Client] EIP pattern.
+
+These error handlers can be applied in the link:dsl.html[DSL] to an
+entire set of rules or a specific routing rule as we show in the next
+examples. Error handling rules are inherited on each routing rule within
+a single link:routebuilder.html[RouteBuilder]
+
+[[ErrorHandler-ShortSummaryoftheprovidedErrorHandlers]]
+Short Summary of the provided Error Handlers
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+[[ErrorHandler-DefaultErrorHandlerhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=113880]]
+link:defaulterrorhandler.html[DefaultErrorHandler]
+++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The link:defaulterrorhandler.html[DefaultErrorHandler] is the default
+error handler in Camel. Unlike link:dead-letter-channel.html[Dead Letter
+Channel] it does not have any dead letter queue, and do *not* handle
+exceptions by default.
+
+[[ErrorHandler-DeadLetterChannelhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=49482]]
+link:dead-letter-channel.html[Dead Letter Channel]
+++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The link:dead-letter-channel.html[Dead Letter Channel] will redeliver at
+most 6 times using 1 second delay, and if the exchange failed it will be
+logged at ERROR level.
+
+You can configure the default dead letter endpoint to use:
+
+or in Spring DSL
+
+[source,xml]
+-----------------------------------------------------------------------------------------------------
+<bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
+  <property name="deadLetterUri" value="log:dead"/>
+</bean>
+
+<camelContext errorHandlerRef="deadLetterErrorHandler" xmlns="http://camel.apache.org/schema/spring">
+  ...
+</camelContext>
+-----------------------------------------------------------------------------------------------------
+
+or also from *Camel 2.3.0 onwards*
+
+[source,xml]
+--------------------------------------------------------------------------------------------------
+<camel:errorHandler id="deadLetterErrorHandler" type="DeadLetterChannel" deadLetterUri="log:dead">
+
+<camel:camelContext errorHandlerRef="deadLetterErrorHandler">
+  ...
+</camel:camelContext>
+--------------------------------------------------------------------------------------------------
+
+[[ErrorHandler-LoggingErrorHandler]]
+Logging Error Handler
++++++++++++++++++++++
+
+The logging error handler will log (by default at ERROR level) whenever
+an uncaught exception is thrown. The logging category, logger and level
+may all be defined in the builder.
+
+[source,java]
+----------------------------------------------------------------------------
+errorHandler(loggingErrorHandler("mylogger.name").level(LoggingLevel.INFO));
+----------------------------------------------------------------------------
+
+or in Spring DSL
+
+[source,xml]
+--------------------------------------------------------------------------------------------------
+<bean id="loggingErrorHandler" class="org.apache.camel.builder.LoggingErrorHandler">
+  <property name="logName" value="mylogger.name"/>
+  <property name="level" value="DEBUG"/>
+</bean>
+
+<camelContext errorHandlerRef="loggingErrorHandler" xmlns="http://camel.apache.org/schema/spring">
+  ...
+</camelContext>
+--------------------------------------------------------------------------------------------------
+
+or also from *Camel 2.3.0 onwards*
+
+[source,xml]
+---------------------------------------------------------------------------------------------------------------
+<camel:errorHandler id="loggingErrorHandler" type="LoggingErrorHandler" logName="mylogger.name" level="DEBUG"/>
+
+<camel:camelContext errorHandlerRef="loggingErrorHandler">
+  ...
+</camel:camelContext>
+---------------------------------------------------------------------------------------------------------------
+
+This would create an error handler which logs exceptions using the
+category mylogger.name and uses the level INFO for all log messages
+created.
+
+[source,java]
+---------------------------------------------------------------------------------------------------------
+from("seda:a").errorHandler(loggingErrorHandler("mylogger.name").level(LoggingLevel.DEBUG)).to("seda:b");
+---------------------------------------------------------------------------------------------------------
+
+Loggers may also be defined for specific routes.
+
+[[ErrorHandler-NoErrorHandler]]
+No Error Handler
+++++++++++++++++
+
+The no error handler is to be used for disabling error handling.
+
+[source,java]
+-------------------------------
+errorHandler(noErrorHandler());
+-------------------------------
+
+or in Spring DSL
+
+[source,xml]
+---------------------------------------------------------------------------------------------
+<bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder"/>
+
+<camelContext errorHandlerRef="noErrorHandler" xmlns="http://camel.apache.org/schema/spring">
+  ...
+</camelContext>
+---------------------------------------------------------------------------------------------
+
+or also from *Camel 2.3.0 onwards*
+
+[source,xml]
+---------------------------------------------------------------
+<camel:errorHandler id="noErrorHandler" type="NoErrorHandler"/>
+
+<camel:camelContext errorHandlerRef="noErrorHandler">
+  ...
+</camel:camelContext>
+---------------------------------------------------------------
+
+[[ErrorHandler]]
+link:transactionerrorhandler.html[TransactionErrorHandler]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+The link:transactionerrorhandler.html[TransactionErrorHandler] is the
+default error handler in Camel for transacted routes.
+
+TIP:If you have marked a route as transacted using the *transacted* DSL then
+Camel will automatic use a
+link:transactionerrorhandler.html[TransactionErrorHandler]. It will try
+to lookup the global/per route configured error handler and use it if
+its a `TransactionErrorHandlerBuilder` instance. If not Camel will
+automatic create a temporary
+link:transactionerrorhandler.html[TransactionErrorHandler] that
+overrules the default error handler. This is convention over
+configuration.
+
+[[ErrorHandler-Featuressupportbyvariouss]]
+Features support by various link:error-handler.html[Error Handler]s
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Here is a breakdown of which features is supported by the
+link:error-handler.html[Error Handler](s):
+
+[width="100%",cols="20%,80%",options="header",]
+|=======================================================================
+Feature |Supported by the following link:error-handler.html[Error Handler]
+
+|all scopes |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|onException |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|onWhen |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|continued |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|handled |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|Custom ExceptionPolicy |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|useOriginalBody |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|retryWhile |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|onRedelivery |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|RedeliveryPolicy |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|asyncDelayedRedelivery |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|redeliverWhileStopping |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:transactionerrorhandler.html[TransactionErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|dead letter queue |link:dead-letter-channel.html[Dead Letter Channel]
+
+|onPrepareFailure |link:defaulterrorhandler.html[DefaultErrorHandler],
+link:dead-letter-channel.html[Dead Letter Channel]
+
+|=======================================================================
+
+See link:exception-clause.html[Exception Clause] documentation for
+documentation of some of the features above.
+
+[[ErrorHandler-Scopes]]
+Scopes
+^^^^^^
+
+The error handler is scoped as either
+
+* global
+* per route
+
+The following example shows how you can register a global error handler
+(in this case using the logging handler)
+
+[source,java]
+---------------------------------------------------------------
+RouteBuilder builder = new RouteBuilder() {
+    public void configure() {
+        // use logging error handler
+        errorHandler(loggingErrorHandler("com.mycompany.foo"));
+ 
+        // here is our regular route
+        from("seda:a").to("seda:b");
+    }
+};
+---------------------------------------------------------------
+
+The following example shows how you can register a route specific error
+handler; the customized logging handler is only registered for the route
+from link:endpoint.html[Endpoint] *seda:a*
+
+[source,java]
+---------------------------------------------------------------
+RouteBuilder builder = new RouteBuilder() {
+    public void configure() {
+        // this route is using a nested logging error handler
+        from("seda:a")
+            // here we configure the logging error handler
+            .errorHandler(loggingErrorHandler("com.mycompany.foo"))
+            // and we continue with the routing here
+            .to("seda:b");
+ 
+        // this route will use the default error handler (DeadLetterChannel)
+        from("seda:b").to("seda:c");
+    }
+};
+---------------------------------------------------------------
+
+[[ErrorHandler-Springbasedconfiguration]]
+Spring based configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Java DSL vs. Spring DSL*
+The error handler is configured a bit differently in Java DSL and Spring
+DSL. Spring DSL relies more on standard Spring bean configuration
+whereas Java DSL uses fluent builders.
+
+
+The error handler can be configured as a spring bean and scoped in:
+
+* global (the camelContext tag)
+* per route (the route tag)
+* or per policy (the policy/transacted tag)
+
+The error handler is configured with the `errorHandlerRef` attribute.
+
+TIP:*Error Handler Hierarchy*
+The error handlers is inherited, so if you only have set a global error
+handler then its use everywhere. But you can override this in a route
+and use another error handler.
+
+[[ErrorHandler-Springbasedconfigurationsample]]
+Spring based configuration sample
++++++++++++++++++++++++++++++++++
+
+In this sample we configure a link:dead-letter-channel.html[Dead Letter
+Channel] on the route that should redeliver at most 3 times and use a
+little delay before retrying. First we configure the reference to *myDeadLetterErrorHandler* using
+the `errorHandlerRef` attribute on the `route` tag.
+
+Then we configure *myDeadLetterErrorHandler* that is our
+link:dead-letter-channel.html[Dead Letter Channel]. This configuration
+is standard Spring using the bean element. +
+ And finally we have another spring bean for the redelivery policy where
+we can configure the options for how many times to redeliver, delays
+etc.
+
+From Camel 2.3.0, camel provides a customer bean configuration for the
+Error Handler, you can find the examples here.
+
+[[ErrorHandler-Usingthetransactionalerrorhandler]]
+Using the transactional error handler
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The transactional error handler is based on spring transaction. This
+requires the usage of the camel-spring component. +
+ See link:transactional-client.html[Transactional Client] that has many
+samples for how to use and transactional behavior and configuration with
+this error handler.
+
+[[ErrorHandler-Seealso]]
+See also
+^^^^^^^^
+
+* link:error-handling-in-camel.html[Error handling in Camel] for
+introduction and background material on error handling in Camel
+* link:dead-letter-channel.html[Dead Letter Channel] for the dead letter
+error handler
+* link:defaulterrorhandler.html[DefaultErrorHandler] for the default
+error handler in Camel
+* link:transactionerrorhandler.html[TransactionErrorHandler] for the
+default error handler for transacted routes
+* link:transactional-client.html[Transactional Client] for transactional
+behavior
+* link:exception-clause.html[Exception Clause] as it supports *handling*
+thrown exceptions
+* link:try-catch-finally.html[Try Catch Finally] for try ... catch ...
+finally as DSL you can use in the routing
+


[2/6] camel git commit: Added expression docs to Gitbook

Posted by ac...@apache.org.
Added expression docs to Gitbook


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

Branch: refs/heads/master
Commit: 54ce159bd1eec1790dd545e8e49eb00e5c4d9401
Parents: 3002f8d
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:14:01 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:14:01 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md      |   2 +-
 docs/user-manual/en/expression.adoc | 136 +++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/54ce159b/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 0ecc6f4..6771ff3 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -33,13 +33,13 @@
     * [Error Handler](error-handler.adoc)
     * [Exchange](exchange.adoc)
     * [Exchange Pattern](exchange-pattern.adoc)
+    * [Expression](expression.adoc)
     * [Intercept](intercept.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Expression](.adoc)
     * [Injector](.adoc)
     * [Inversion Of Control With Smart Defaults](.adoc)
     * [Languages](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/54ce159b/docs/user-manual/en/expression.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/expression.adoc b/docs/user-manual/en/expression.adoc
new file mode 100644
index 0000000..9b7f5ac
--- /dev/null
+++ b/docs/user-manual/en/expression.adoc
@@ -0,0 +1,136 @@
+[[Expression-Expressions]]
+Expressions
+~~~~~~~~~~~
+
+Expressions and link:predicate.html[Predicates] can then be used to
+create the various link:enterprise-integration-patterns.html[Enterprise
+Integration Patterns] in the link:dsl.html[DSL] or
+link:xml-configuration.html[Xml Configuration] like the
+link:recipient-list.html[Recipient List]. +
+ To support dynamic rules Camel supports pluggable
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Expression.html[Expression]
+strategies using a variety of different link:languages.html[Languages].
+
+[[Expression-API]]
+API
+^^^
+
+If you are outside of the link:dsl.html[DSL] and want to create your own
+expressions you can either implement the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Expression.html[Expression
+interface], reuse one of the other builders or try the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/builder/ExpressionBuilder.html[ExpressionBuilder
+class].
+
+[[Expression-Expression]]
+Expression
+++++++++++
+
+The API for a Camel Expression is defined in the
+`org.apache.camel.Expression` interface as shown:
+
+[source,java]
+-------------------------------------------------------------------------------
+public interface Expression {
+
+    /**
+     * Returns the value of the expression on the given exchange
+     *
+     * @param exchange the message exchange on which to evaluate the expression
+     * @param type the expected type of the evaluation result
+     * @return the value of the expression
+     */
+    <T> T evaluate(Exchange exchange, Class<T> type);
+}
+-------------------------------------------------------------------------------
+
+[[Expression-Predicate]]
+Predicate
++++++++++
+
+The API for a Camel Predicate is defined in the
+`org.apache.camel.Predicate` interface as shown:
+
+[source,java]
+-------------------------------------------------------------------------------
+public interface Predicate {
+
+    /**
+     * Evaluates the predicate on the message exchange and returns true if this
+     * exchange matches the predicate
+     * 
+     * @param exchange the message exchange
+     * @return true if the predicate matches
+     */
+    boolean matches(Exchange exchange);
+
+}
+-------------------------------------------------------------------------------
+
+[[Expression-ExpressionLanguages]]
+Expression Languages
+^^^^^^^^^^^^^^^^^^^^
+
+The following languages are supported out of the box
+
+* link:bean-language.html[Bean Language] for using Java for expressions
+* link:constant.html[Constant]
+* the unified link:el.html[EL] from JSP and JSF
+* link:header.html[Header]
+* link:jsonpath.html[JSonPath]
+* link:jxpath.html[JXPath]
+* link:mvel.html[Mvel]
+* link:ognl.html[OGNL]
+* link:ref-language.html[Ref Language]
+* link:exchangeproperty.html[ExchangeProperty]
+/�link:property.html[Property]
+* link:scripting-languages.html[Scripting Languages] such as
+** link:beanshell.html[BeanShell]
+** link:javascript.html[JavaScript]
+** link:groovy.html[Groovy]
+** link:python.html[Python]
+** link:php.html[PHP]
+** link:ruby.html[Ruby]
+* link:simple.html[Simple]
+** link:file-language.html[File Language]
+* link:spel.html[Spring Expression Language]
+* link:sql.html[SQL]
+* link:tokenizer.html[Tokenizer]
+* link:xpath.html[XPath]
+* link:xquery.html[XQuery]
+* link:vtd-xml.html[VTD-XML]
+
+Most of these languages is also supported used as
+link:annotation-based-expression-language.html[Annotation Based
+Expression Language].
+
+[[Expression-UsingExpressionsinyourIDE]]
+Using Expressions in your IDE
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To use different expression and predicates in your IDE you need to
+perform a static import of the builder class for the language(s) you
+wish to use.
+
+[width="100%",cols="20%,80%",options="header",]
+|=======================================================================
+|Language(s) |Builder class to import
+
+|link:scripting-languages.html[Scripting Languages] such as
+link:beanshell.html[BeanShell], link:javascript.html[JavaScript],
+link:groovy.html[Groovy], link:php.html[PHP], link:python.html[Python]
+and link:ruby.html[Ruby] |http://camel.apache.org/maven/current/camel-script/apidocs/org/apache/camel/builder/script/ScriptBuilder.html[org.apache.camel.builder.script.ScriptBuilder]
+
+|link:sql.html[SQL] |http://camel.apache.org/maven/current/camel-josql/apidocs/org/apache/camel/builder/sql/SqlBuilder.html[org.apache.camel.builder.josql.SqlBuilder]
+
+|link:xpath.html[XPath] |http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/builder/xml/XPathBuilder.html[org.apache.camel.builder.xml.XPathBuilder]
+
+|link:xquery.html[XQuery] |http://camel.apache.org/maven/current/camel-saxon/apidocs/org/apache/camel/builder/saxon/XQueryBuilder.html[org.apache.camel.builder.saxon.XQueryBuilder]
+|=======================================================================
+
+[[Expression-SeeAlso]]
+See Also
+++++++++
+
+* link:predicate.html[Predicate]
+


[5/6] camel git commit: Added Camel lifecycle docs to Gitbook

Posted by ac...@apache.org.
Added Camel lifecycle docs to Gitbook


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

Branch: refs/heads/master
Commit: 72a6ab42828fc858b90928ed9040589494748d36
Parents: fe94f55
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:24:25 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:24:25 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md                  |   3 +-
 docs/user-manual/en/lifecycle.adoc              | 117 +++++++++++++++++++
 .../en/lifecycle.data/service_lifecycle.png     | Bin 0 -> 35951 bytes
 3 files changed, 118 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/72a6ab42/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 27a2798..842c71a 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -37,13 +37,12 @@
     * [Injector](injector.adoc)
     * [Intercept](intercept.adoc)
     * [Inversion Of Control With Smart Defaults](inversion-of-control-with-smart-defaults.adoc)
+    * [Lifecycle](lifecycle.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Languages](.adoc)
-    * [Lifecycle](.adoc)
     * [OnCompletion](.adoc)
     * [Pluggable Class Resolvers](.adoc)
     * [Predicate](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/72a6ab42/docs/user-manual/en/lifecycle.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/lifecycle.adoc b/docs/user-manual/en/lifecycle.adoc
new file mode 100644
index 0000000..c86f2eb
--- /dev/null
+++ b/docs/user-manual/en/lifecycle.adoc
@@ -0,0 +1,117 @@
+[[Lifecycle-CamelLifecycle]]
+Camel Lifecycle
+~~~~~~~~~~~~~~~
+
+Camel uses a simple _lifecycle_ interface called
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Service.html[Service]
+which has a single start() and stop() method.
+
+Various classes implement Service such as
+link:camelcontext.html[CamelContext] along with a number of
+link:component.html[Component] and link:endpoint.html[Endpoint] classes.
+
+When you use Camel you typically have to start the
+link:camelcontext.html[CamelContext] which will start all the various
+components and endpoints and activate the routing rules until the
+context is stopped again.
+
+If you are working with Spring you may wish to read the
+link:spring.html[Camel Spring documentation].
+
+[[Lifecycle-CamelContextLifecycle]]
+CamelContext Lifecycle
+^^^^^^^^^^^^^^^^^^^^^^
+
+The `CamelContext` provides methods to control its lifecycle:
+
+* `start`
+* `stop`
+* `suspend` *Camel 2.5*
+* `resume` *Camel 2.5*
+
+The operations is paired: start/stop and suspend/resume.
+
+Stop is performing a link:graceful-shutdown.html[Graceful shutdown]
+which means all its internal state, cache, etc is cleared. And the
+routes is being stopped in a graceful manner to ensure messages is given
+time to complete. If you start a `CamelContext` after a stop, then its
+performing a _cold_ start, recreating all the state, cache etc. again.
+
+Instead you can use the suspend/resume operations. They will keep the
+`CamelContext` _warm_ and only suspend/stop routes using the same
+link:graceful-shutdown.html[Graceful shutdown] feature. This ensures
+messages is given time to complete.
+
+End users is encouraged to use suspend/resume if you are temporary
+stopping a Camel application.
+
+All these operations is available in link:camel-jmx.html[JMX] as well,
+so you can control Camel from a management console.
+
+If you write unit tests and perform _cold_ restarts using stop/start
+then any previously looked up link:endpoint.html[Endpoint]s etc. is
+obsolete, and therefore you need to re-lookup those endpoints again.
+
+Instead use suspend/resume which keeps these
+link:endpoint.html[Endpoint]s and therefore you can still use them after
+resuming.
+
+[[Lifecycle-Servicelifecycle]]
+Service lifecycle
+^^^^^^^^^^^^^^^^^
+
+A service (`org.apache.camel.Service`) in Camel adheres to the following
+lifecycle states as illustrated in the diagram below:
+
+image:lifecycle.data/service_lifecycle.png[image]
+
+*Notice:* A service can optimally support suspend/resume by the
+`org.apache.camel.SuspendableService`. This means not all services in
+Camel supports suspension. It's encouraged that consumers support
+suspension which allows to suspend/resume routes.
+
+The `org.apache.camel.impl.ServiceSupport` is a good base class to
+extend for custom services as it offers the basic functionally to keep
+track of state. You implement your custom logic in the `doStart`,
+`doStop`, `doSuspend`, `doResume` methods.
+
+[[Lifecycle-Routeslifecycle]]
+Routes lifecycle
+^^^^^^^^^^^^^^^^
+
+Routes in Camel have the following operations to control its lifecycle
+
+* `start`
+* `stop`
+* `suspend`
+* `resume`
+* `remove` (previously named shutdown)
+
+The `remove` operation will *remove* the route, for example in
+link:camel-jmx.html[JMX] the route will then be unregistered and its
+gone. So only use remove if you really want to remove the route. The
+route must have been stopped before you can remove.
+
+The `start` and `resume` operations in link:camel-jmx.html[JMX] checks
+the state beforehand. So if a route is stopped and you click `resume`,
+it will know to invoke `start`. And likewise if a route has been
+suspended and you click `start` it knows to `resume` instead. This makes
+management a bit easier.
+
+If a route is suspended then it keeps its resources and all their JMX
+metrics alive. Where as stopping a route will graceful stop the route,
+and clear its resources, and as well their JMX metrics. If you want to
+temporary "pause" a route, then consider using suspend/resume over
+stop/start.
+
+If a route consumer does not support suspension, it will fallback and
+stop the route instead.
+
+[[Lifecycle-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:camelcontext.html[CamelContext]
+* link:architecture.html[Architecture]
+* link:camel-jmx.html[JMX]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/72a6ab42/docs/user-manual/en/lifecycle.data/service_lifecycle.png
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/lifecycle.data/service_lifecycle.png b/docs/user-manual/en/lifecycle.data/service_lifecycle.png
new file mode 100644
index 0000000..41a90b4
Binary files /dev/null and b/docs/user-manual/en/lifecycle.data/service_lifecycle.png differ


[6/6] camel git commit: Added onCompletion docs to Gitbook

Posted by ac...@apache.org.
Added onCompletion docs to Gitbook


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

Branch: refs/heads/master
Commit: bd6f1d284a25015bc7a9a4aa69e0cdbcda38d923
Parents: 72a6ab4
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:56:16 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:56:16 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md        |   2 +-
 docs/user-manual/en/oncompletion.adoc | 332 +++++++++++++++++++++++++++++
 2 files changed, 333 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd6f1d28/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 842c71a..d3111e4 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -38,12 +38,12 @@
     * [Intercept](intercept.adoc)
     * [Inversion Of Control With Smart Defaults](inversion-of-control-with-smart-defaults.adoc)
     * [Lifecycle](lifecycle.adoc)
+    * [OnCompletion](oncompletion.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [OnCompletion](.adoc)
     * [Pluggable Class Resolvers](.adoc)
     * [Predicate](.adoc)
     * [Processor](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/bd6f1d28/docs/user-manual/en/oncompletion.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/oncompletion.adoc b/docs/user-manual/en/oncompletion.adoc
new file mode 100644
index 0000000..e9c117e
--- /dev/null
+++ b/docs/user-manual/en/oncompletion.adoc
@@ -0,0 +1,332 @@
+[[OnCompletion-OnCompletion]]
+OnCompletion
+~~~~~~~~~~~~
+
+Camel has this concept of a Unit of Work that encompass the
+link:exchange.html[Exchange]. The unit of work among others supports
+synchronization callbacks that are invoked when the
+link:exchange.html[Exchange] is complete. The callback API is defined in
+`org.apache.camel.spi.Synchronization`. From *Camel 2.14* onwards we
+have an extended synchronization
+`org.apache.camel.spi.SynchronizationRouteAware`�that have callbacks for
+route events.
+
+*Getting the UnitOfWork*
+
+You can get hold of the `org.apache.camel.spi.UnitOfWork` from
+`org.apache.camel.Exchange` with the method `getUnitOfWork()`.
+
+In Camel 2.0 we have added DSL for these callbacks using the new
+*onCompletion* DSL name.
+
+*onCompletion* supports the following features:
+
+* scope: global and/or per route (route scope override all global scope)
+* multiple global scope
+* triggered either always, only if completed with success, or only if
+failed
+* `onWhen` predicate to only trigger in certain situations
+* *Camel 2.14:* mode: to define whether to run either before or after
+route consumer writes response back to callee (if its InOut)
+* *Camel 2.14:*whether to run async or sync (use a thread pool or not)
+
+From�*Camel 2.14* onwards the onCompletion has been modified to support
+running the completion task in either synchronous or asynchronous mode
+(using a thread pool) and also whether to run before or after the route
+consumer is done. The reason is to give more flexibility. For example to
+specify to run synchronous and before the route consumer is done, which
+allows to modify the exchange before the consumer writes back any
+response to the callee. You can use this to for example add customer
+headers, or send to a log to log the response message, etc.
+
+
+*Changes from Camel 2.14 onwards*
+The onCompletion has changed defaults and behavior from Camel 2.14
+onwards. It now runs
+* Runs synchronously without any thread pool
+In Camel 2.13 the defaults were
+* Runs asynchronous using a thread pool
+
+
+*Camel 2.13 or older - On completion runs in separate thread*
+
+The *onCompletion* runs in a separate thread in parallel with the
+original route. It is therefore not intended to influence the outcome of
+the original route. The idea for on completion is to spin off a new
+thread to eg send logs to a central log database, send an email, send
+alterts to a monitoring system, store a copy of the result message
+etc. +
+ Therefore if you want to do some work that influence the original
+route, then do *not* use *onCompletion* for that. Notice: if you use the
+`UnitOfWork` API as mentioned in the top of this page, then you can
+register a `Synchronization` callback on the
+link:exchange.html[Exchange] which is executed in the original route.
+That way allows you to do some custom code when the route is completed;
+this is how custom components can enlist on completion services which
+they need, eg the link:file2.html[File] component does that for work
+that moves/deletes the original file etc.
+
+[[OnCompletion-onCompletionwithroutescope]]
+onCompletion with route scope
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The *onCompletion* DSL allows you to add custom routes/processors when
+the original link:exchange.html[Exchange] is complete. Camel spin off a
+copy of the link:exchange.html[Exchange] and routes it in a separate
+thread, kinda like a link:wire-tap.html[Wire Tap]. This allows the
+original thread to continue while the *onCompletion* route is running
+concurrently. We decided for this model as we did not want the
+*onCompletion* route to interfere with the original route.
+
+*Only 1 onCompletion supported by route scope*
+
+You can only have 1 onCompletion in a route. Only at context scoped
+level you can have multiple. And notice that when you use a route scoped
+onCompletion then any context scoped are disabled for that given route.
+
+[source,java]
+-----------------------------------------------------------
+from("direct:start")
+    .onCompletion()
+        // this route is only invoked when the original route is complete as a kind
+        // of completion callback
+        .to("log:sync")
+        .to("mock:sync")
+    // must use end to denote the end of the onCompletion route
+    .end()
+    // here the original route contiues
+    .process(new MyProcessor())
+    .to("mock:result");
+-----------------------------------------------------------
+
+By default the *onCompletion* will be triggered when the
+link:exchange.html[Exchange] is complete and regardless if the
+link:exchange.html[Exchange] completed with success or with an failure
+(such as an Exception was thrown). You can limit the trigger to only
+occur `onCompleteOnly` or by `onFailureOnly` as shown below:
+
+[source,java]
+-----------------------------------------------------------
+from("direct:start")
+    // here we qualify onCompletion to only invoke when the exchange failed (exception or FAULT body)
+    .onCompletion().onFailureOnly()
+        .to("log:sync")
+        .to("mock:sync")
+    // must use end to denote the end of the onCompletion route
+    .end()
+    // here the original route continues
+    .process(new MyProcessor())
+    .to("mock:result");
+-----------------------------------------------------------
+
+You can identify if the link:exchange.html[Exchange] is an
+*onCompletion* link:exchange.html[Exchange] as Camel will add the
+property `Exchange.ON_COMPLETION` with a boolean value of `true` when it
+spin offs the *onCompletion* link:exchange.html[Exchange].
+
+[[OnCompletion-UsingonCompletionfromSpringDSL]]
+Using onCompletion from Spring DSL
+++++++++++++++++++++++++++++++++++
+
+The onCompletion is defined like this with Spring DSL:
+
+[source,xml]
+-----------------------------------------------------------
+<route>
+    <from uri="direct:start"/>
+    <!-- this onCompletion block will only be executed when the exchange is done being routed -->
+    <!-- this callback is always triggered even if the exchange failed -->
+    <onCompletion>
+        <!-- so this is a kinda like an after completion callback -->
+        <to uri="log:sync"/>
+        <to uri="mock:sync"/>
+    </onCompletion>
+    <process ref="myProcessor"/>
+    <to uri="mock:result"/>
+</route>
+-----------------------------------------------------------
+
+And the `onCompleteOnly` and `onFailureOnly` is defined as a boolean
+attribute on the <onCompletion> tag so the failure example would be:
+
+[source,xml]
+-----------------------------------------------------------
+<route>
+    <from uri="direct:start"/>
+    <!-- this onCompletion block will only be executed when the exchange is done being routed -->
+    <!-- this callback is only triggered when the exchange failed, as we have onFailure=true -->
+    <onCompletion onFailureOnly="true">
+        <to uri="log:sync"/>
+        <to uri="mock:sync"/>
+    </onCompletion>
+    <process ref="myProcessor"/>
+    <to uri="mock:result"/>
+</route>
+-----------------------------------------------------------
+
+[[OnCompletion-onCompletionwithglobalscope]]
+onCompletion with global scope
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This works just like the route scope except from the fact that they are
+defined globally. An example below:
+
+[source,java]
+-----------------------------------------------------------
+// define a global on completion that is invoked when the exchange is complete
+onCompletion().to("log:global").to("mock:sync");
+ 
+from("direct:start")
+    .process(new MyProcessor())
+    .to("mock:result");
+-----------------------------------------------------------
+
+[[OnCompletion-UsingonCompletionfromSpringDSL.1]]
+Using onCompletion from Spring DSL
+++++++++++++++++++++++++++++++++++
+
+This works just like the route scope except from the fact that they are
+defined globally. An example below:
+
+[source,xml]
+-----------------------------------------------------------
+<!-- this is a global onCompletion route that is invoke when any exchange is complete
+     as a kind of after callback -->
+<onCompletion>
+    <to uri="log:global"/>
+    <to uri="mock:sync"/>
+</onCompletion>
+ 
+<route>
+    <from uri="direct:start"/>
+    <process ref="myProcessor"/>
+    <to uri="mock:result"/>
+</route>
+-----------------------------------------------------------
+
+
+*Route scope override Global scope*
+If an *onCompletion* is defined in a route, it overrides *all* global
+scoped and thus its only the route scoped that are used. The globally
+scoped ones are never used.
+
+[[OnCompletion-UsingonCompletionwithonWhenpredicate]]
+Using onCompletion with onWhen predicate
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+As other DSL in Camel you can attach a link:predicate.html[Predicate] to
+the *onCompletion* so it only triggers in certain conditions, when the
+predicate matches. For example to only trigger if the message body contains the word
+`Hello` we can do like:
+
+[source,java]
+-----------------------------------------------------------
+from("direct:start")
+    .onCompletion().onWhen(body().contains("Hello"))
+        // this route is only invoked when the original route is complete as a kind
+        // of completion callback. And also only if the onWhen predicate is true
+        .to("log:sync")
+        .to("mock:sync")
+    // must use end to denote the end of the onCompletion route
+    .end()
+    // here the original route contiues
+    .to("log:original")
+    .to("mock:result");
+-----------------------------------------------------------
+
+[[OnCompletion-UsingonCompletionwithorwithoutthreadpool]]
+Using onCompletion with or without thread pool
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.14*
+
+OnCompletion will from Camel 2.14 onwards not use thread pool by
+default. To use thread pool then either set a�`executorService` or set
+`parallelProcessing` to true.
+
+For example in Java DSL do
+
+[source,java]
+-----------------------------------------------------------
+                onCompletion().parallelProcessing()
+                    .to("mock:before")
+                    .delay(1000)
+                    .setBody(simple("OnComplete:${body}"));
+-----------------------------------------------------------
+
+And in XML DSL
+
+[source,java]
+--------------------------------------------------------------
+      <onCompletion parallelProcessing="true">
+        <to uri="before"/>
+        <delay><constant>1000</constant></delay>
+        <setBody><simple>OnComplete:${body}</simple></setBody>
+      </onCompletion>
+--------------------------------------------------------------
+
+You can also refer to a specific link:threading-model.html[thread pool]
+to be used, using the executorServiceRef option
+
+[source,java]
+--------------------------------------------------------------
+      <onCompletion executorServiceRef="myThreadPool">
+        <to uri="before"/>
+        <delay><constant>1000</constant></delay>
+        <setBody><simple>OnComplete:${body}</simple></setBody>
+      </onCompletion>
+--------------------------------------------------------------
+
+�
+
+[[OnCompletion-UsingonCompletiontorunbeforerouteconsumersendsbackresponsetocallee]]
+Using onCompletion to run before route consumer sends back response to callee
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+*Available as of Camel 2.14*
+
+OnCompletion supports two modes
+
+* AfterConsumer - Default mode which runs after the consumer is done
+* BeforeConsumer - Runs before the consumer is done, and before the
+consumer writes back response to the callee
+
+The AfterConsumer mode is the default mode which is the same behavior as
+in older Camel releases.
+
+The new BeforeConsumer mode is used to run onCompletion before the
+consumer writes its response back to the callee (if in InOut mode). This
+allows the onCompletion to modify the Exchange, such as adding special
+headers, or to log the Exchange as a response logger etc.
+
+For example to always add a "created by" header you
+use�`modeBeforeConsumer()` as shown below:
+
+[source,java]
+----------------------------------------------------
+    .onCompletion().modeBeforeConsumer()
+        .setHeader("createdBy", constant("Someone"))
+    .end()
+----------------------------------------------------
+
+�
+
+And in XML DSL you set the mode attribute to BeforeConsumer:
+
+[source,java]
+------------------------------------------
+      <onCompletion mode="BeforeConsumer">
+        <setHeader headerName="createdBy">
+          <constant>Someone</constant>
+        </setHeader>
+      </onCompletion>
+------------------------------------------
+
+�
+
+[[OnCompletion-SeeAlso]]
+See Also
+^^^^^^^^
+
+* Unit of Work
+


[4/6] camel git commit: Added inversion of control docs to Gitbook

Posted by ac...@apache.org.
Added inversion of control docs to Gitbook


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

Branch: refs/heads/master
Commit: fe94f55588ebde7db86182d40cfaa6aaf9335bd6
Parents: ef01a66
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:20:10 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:20:10 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md                  |  2 +-
 ...nversion-of-control-with-smart-defaults.adoc | 30 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fe94f555/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 22a1db3..27a2798 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -36,12 +36,12 @@
     * [Expression](expression.adoc)
     * [Injector](injector.adoc)
     * [Intercept](intercept.adoc)
+    * [Inversion Of Control With Smart Defaults](inversion-of-control-with-smart-defaults.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Inversion Of Control With Smart Defaults](.adoc)
     * [Languages](.adoc)
     * [Lifecycle](.adoc)
     * [OnCompletion](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/fe94f555/docs/user-manual/en/inversion-of-control-with-smart-defaults.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/inversion-of-control-with-smart-defaults.adoc b/docs/user-manual/en/inversion-of-control-with-smart-defaults.adoc
new file mode 100644
index 0000000..0a928f0
--- /dev/null
+++ b/docs/user-manual/en/inversion-of-control-with-smart-defaults.adoc
@@ -0,0 +1,30 @@
+[[InversionOfControlWithSmartDefaults-InversionOfControlWithSmartDefaults]]
+Inversion Of Control With Smart Defaults
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Inversion of Control is a powerful way of wiring together your beans so
+that the beans themselves can stay simple & be injected with their
+dependencies by their IoC container. One of the downsides of wring
+everything together using an IoC container like Spring is that you can
+often en up with huge amounts of XML configuring everything.
+
+The Inversion Of Control With Smart Defaults pattern attempts to address
+this by providing in-built smart defaults into the system so that you
+only have to actually configure things which are not the default
+behavior.
+
+For example with Camel you can configure a
+link:camelcontext.html[CamelContext]; capable of creating on demand
+link:component.html[Component] and link:endpoint.html[Endpoint]
+instances along with providing a powerful link:type-converter.html[Type
+Converter] registry all by using a single XML element...
+
+[source,java]
+---------------------------------------------------------------------
+<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+</camelContext>
+---------------------------------------------------------------------
+
+If you explicitly want to configure the context; a component, an
+endpoint or dependent objects explicitly in XML you can; but all the
+common defaults are wired together for you.


[3/6] camel git commit: Added Injector docs to Gitbook

Posted by ac...@apache.org.
Added Injector docs to Gitbook


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

Branch: refs/heads/master
Commit: ef01a66f078315983cc9b295dff7fcd5d379eaf3
Parents: 54ce159
Author: Andrea Cosentino <an...@gmail.com>
Authored: Sun Jul 31 11:17:26 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Sun Jul 31 11:17:26 2016 +0200

----------------------------------------------------------------------
 docs/user-manual/en/SUMMARY.md    |  3 +--
 docs/user-manual/en/injector.adoc | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ef01a66f/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 6771ff3..22a1db3 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -34,13 +34,13 @@
     * [Exchange](exchange.adoc)
     * [Exchange Pattern](exchange-pattern.adoc)
     * [Expression](expression.adoc)
+    * [Injector](injector.adoc)
     * [Intercept](intercept.adoc)
     * [Registry](registry.adoc)
     * [RX](rx.adoc)
     * [Scala DSL](scala-dsl.adoc)
 
 <!--
-    * [Injector](.adoc)
     * [Inversion Of Control With Smart Defaults](.adoc)
     * [Languages](.adoc)
     * [Lifecycle](.adoc)
@@ -64,7 +64,6 @@
     * [Security](.adoc)
     * [UuidGenerator](.adoc)
     * [Binding](.adoc)
-    * [CEP](.adoc)
     * [BacklogTracer](.adoc)
     * [Endpoint Annotations](.adoc)
     * [ComponentConfiguration](.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/ef01a66f/docs/user-manual/en/injector.adoc
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/injector.adoc b/docs/user-manual/en/injector.adoc
new file mode 100644
index 0000000..a19a0d7
--- /dev/null
+++ b/docs/user-manual/en/injector.adoc
@@ -0,0 +1,24 @@
+[[Injector-Injector]]
+Injector
+~~~~~~~~
+
+The
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/Injector.html[Injector]
+is a pluggable strategy to any IoC container such as
+link:spring.html[Spring] or Guice to be able to create and
+dependency-inject objects of a certain type.
+
+For example if you are using the
+link:inversion-of-control-with-smart-defaults.html[Inversion Of Control
+With Smart Defaults] pattern to minimize your XML dependency; Camel will
+automatically discover and use new endpoints when they are referenced
+via their link:uris.html[URIs] by using the META-INF/services settings.
+You could explicitly configure each link:component.html[Component] and
+link:endpoint.html[Endpoint] in your Spring XML file; or let Camel find
+the defaults then use the Injector to create and inject any of its
+dependencies.
+
+As an example; consider the link:jms.html[JMS] component. Rather than
+explicitly configuring the JMS component in Spring XML you can just
+provide a ConnectionFactory in your Spring XML which the Injector will
+use to properly configure the JmsComponent when it is instantiated.