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

[camel] branch master updated (3b17a7f -> 8c9db4d)

This is an automated email from the ASF dual-hosted git repository.

tsato pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 3b17a7f  CAMEL-13014 - Fixed CS
     new 3c6267c  CAMEL-11497: Migrate user guide - Configuring routes startup ordering and autostartup
     new 0abb6dd  CAMEL-12988: Update doc to clarify how to specify routes to start up last
     new 8c9db4d  camel-restlet - Fix admonition style in doc

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/camel/processor/RouteStartupOrderLastTest.java     | 4 ++--
 components/camel-restlet/src/main/docs/restlet-component.adoc     | 8 +++-----
 .../configuring-route-startup-ordering-and-autostartup.adoc       | 0
 docs/user-manual/modules/ROOT/pages/getting-started.adoc          | 2 +-
 docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc        | 4 ++--
 5 files changed, 8 insertions(+), 10 deletions(-)
 copy docs/user-manual/{modules/ROOT/pages => en}/configuring-route-startup-ordering-and-autostartup.adoc (100%)


[camel] 02/03: CAMEL-12988: Update doc to clarify how to specify routes to start up last

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0abb6ddd93730d20459b34d230bdc2caab96fbce
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Mon Dec 10 16:08:51 2018 +0900

    CAMEL-12988: Update doc to clarify how to specify routes to start up last
    
    (cherry picked from commit 5923ea113474281a07067697da5c1261bf9d8bc4)
---
 .../camel/processor/RouteStartupOrderLastTest.java |  4 +-
 ...ing-route-startup-ordering-and-autostartup.adoc | 48 ++++++++++++++++++----
 2 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderLastTest.java b/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderLastTest.java
index 106745c..a1b32b5 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderLastTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/RouteStartupOrderLastTest.java
@@ -61,7 +61,7 @@ public class RouteStartupOrderLastTest extends ContextTestSupport {
                 // should start first
                 from("seda:foo").startupOrder(1).to("mock:result");
 
-                // should start last after the default routes route
+                // should start last after the default routes
                 from("direct:bar").startupOrder(12345).to("seda:bar");
 
                 // use auto assigned startup ordering
@@ -69,4 +69,4 @@ public class RouteStartupOrderLastTest extends ContextTestSupport {
             }
         };
     }
-}
\ No newline at end of file
+}
diff --git a/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc b/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc
index b7dc5d0..b993e38 100644
--- a/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc
+++ b/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc
@@ -111,15 +111,24 @@ Camel started the routes in a non deterministic order. Now you have fine
 grained control in which order the routes should be started. There is a
 new attribute `startupOrder` which is an `Integer` that states the order.
 Camel then sorts the routes before starting time. The routes with the
-lowest `startupOrder` is started first. All `startupOrder` defined must
-be unique among all routes in your
-link:camelcontext.adoc[CamelContext].
+lowest `startupOrder` are started first and the ones with the highest are
+started last.
 
-You should also use numbers that are lower than 1000, as routes without
-an explicit `startupOrder` define will have a number starting from 1000
+IMPORTANT: All `startupOrder` defined must be unique among all routes in your
+link:camelcontext.adoc[CamelContext]. Otherwise if there are clashes in
+`startupOrder` numbers among routes, the routes will fail to start up throwing
+`org.apache.camel.FailedToStartRouteException`.
+
+Normally you should also use numbers that are lower than 1000, as routes without
+an explicit `startupOrder` definition will have a number starting from 1000
 auto assigned. So view numbers from 1000 upwards as reserved internally
 for Camel itself.
 
+However, you can also utilise much higher numbers than 1000
+(to avoid collisions with those auto assigned numbers) to specify the last routes
+to start up. Normally the usage of numbers starting from 10000 should be safe
+for the purpose.
+
 In terms of the `startupOrder` there are no strict rules that it must
 start from 1 and increment by 1. You can for example use: 100, 200, 205,
 89 if you like. Only rule of thumb is that the numbers must be unique.
@@ -148,7 +157,7 @@ were started.
 Let's try a couple of examples.
 
 [[Configuringroutestartuporderingandautostartup-Simpleexample]]
-==== Simple example
+===== Simple example
 
 [source,java]
 ----
@@ -172,7 +181,7 @@ And the same example with XML DSL:
 ----
 
 In this example we have two routes in which we have started that the
-`direct:start` route should be started *after* the `seda:foo` route. +
+`direct:start` route should be started *after* the `seda:foo` route.
 As `direct:start` is consider the input and we want that `seda:foo`
 route to be up and running beforehand.
 
@@ -218,6 +227,31 @@ last.
 So you can use this to your advantage to only assign a `startupOrder` on
 the routes which really needs it.
 
+[[Configuringroutestartuporderingandautostartup-Routestostartuplast]]
+===== Routes to start up last
+
+[source,java]
+----
+    // use auto assigned startup ordering
+    from("direct:start").to("seda:foo");
+
+    // should start first
+    from("seda:foo").startupOrder(1).to("mock:result");
+
+    // should start last after the default routes
+    from("direct:bar").startupOrder(12345).to("seda:bar");
+
+    // use auto assigned startup ordering
+    from("seda:bar").to("mock:other");
+----
+
+In the example above the order of startups of routes should be:
+
+1. `seda://foo`
+2. `direct://start`
+3. `seda://bar`
+4. `direct://bar`
+
 [[Configuringroutestartuporderingandautostartup-Shutdown]]
 ==== Shutdown
 


[camel] 01/03: CAMEL-11497: Migrate user guide - Configuring routes startup ordering and autostartup

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3c6267cf0b464b005fe253e881afff291ca8640c
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Mon Dec 10 15:17:09 2018 +0900

    CAMEL-11497: Migrate user guide - Configuring routes startup ordering and autostartup
    
    (cherry picked from commit 0baf58259c185c3a8a48a0e96ffed5a637ea0c8e)
---
 ...ing-route-startup-ordering-and-autostartup.adoc | 237 +++++++++++++++++++++
 .../modules/ROOT/pages/getting-started.adoc        |   2 +-
 .../modules/ROOT/pages/graceful-shutdown.adoc      |   4 +-
 3 files changed, 240 insertions(+), 3 deletions(-)

diff --git a/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc b/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc
new file mode 100644
index 0000000..b7dc5d0
--- /dev/null
+++ b/docs/user-manual/en/configuring-route-startup-ordering-and-autostartup.adoc
@@ -0,0 +1,237 @@
+[[Configuringroutestartuporderingandautostartup-Configuringroutesstartuporderingandautostartup]]
+=== Configuring routes startup ordering and autostartup
+
+*Available as of Camel 2.1*
+
+Camel now supports configuring two aspects:
+
+* auto startup
+* order of starting routes
+
+[[Configuringroutestartuporderingandautostartup-ConfiguringwhetherCamelshouldbeautostartedornotinXMLDSL]]
+==== Configuring whether Camel should be auto started or not in XML DSL
+
+The old option `shouldStartContext` have been removed and replaced with
+this new `autoStartup` option instead. What it allows is to configure
+Camel to *not* auto start when Spring starts.
+
+For example the route below we have configured `autoStartup=false` to
+prevent Camel starting when Spring starts.
+
+[source,xml]
+----
+    <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring" autoStartup="false">
+        <route>
+            <from uri="direct:start"/>
+            <to uri="mock:result"/>
+        </route>
+    </camelContext>
+----
+
+So how do you start Camel then?
+
+The `autoStartup` option on the `<camelContext>` is only used once, so you
+can manually start Camel later by invoking its `start` method as shown
+below:
+
+[source,java]
+----
+    ApplicationContext ac = ...
+    SpringCamelContext camel = (SpringCamelContext) ac.getBean("myCamel");
+
+    // now start Camel manually
+    camel.start();
+----
+
+[[Configuringroutestartuporderingandautostartup-ConfiguringwhetherarouteshouldbestartedornotinXMLDSL]]
+==== Configuring whether a route should be started or not in XML DSL
+
+You can use the `autoStartup` option to configure if a given route
+should be started when Camel starts. By default a route is auto started.
+
+You can disable or enable it as follows.
+
+In XML DSL you define it as follows:
+
+[source,xml]
+----
+<route autoStartup="false">
+   <from uri="activemq:queue:special"/>
+   <to uri="file://backup"/>
+</route>
+----
+
+And to explicit state it should be started:
+
+[source,xml]
+----
+<route autoStartup="true">
+   <from uri="activemq:queue:special"/>
+   <to uri="file://backup"/>
+</route>
+----
+
+[[Configuringroutestartuporderingandautostartup-ConfiguringwhetherarouteshouldbestartedornotinJavaDSL]]
+==== Configuring whether a route should be started or not in Java DSL
+
+You can use the `autoStartup` option to configure if a given route
+should be started when Camel starts. By default a route is auto started.
+
+You can disable or enable it as follows:
+
+[source,java]
+----
+from("activemq:queue:special").noAutoStartup().to("file://backup");
+----
+
+[[Configuringroutestartuporderingandautostartup-ConfiguringwhetherarouteshouldbestartedornotusingabooleanorStringinJavaDSL]]
+==== Configuring whether a route should be started or not, using a boolean or String, in Java DSL
+
+*Available as of Camel 2.9*
+
+To startup based on a boolean, String or
+<<properties-component,Property>>, do one of the following:
+
+[source,java]
+----
+boolean startupRoute = true;
+from("activemq:queue:special").autoStartup(startupRoute).to("file://backup");
+...
+String startupRoute = "true";
+from("activemq:queue:special").autoStartup(startupRoute).to("file://backup");
+...
+from("activemq:queue:special").autoStartup("{{startupRouteProperty}}").to("file://backup");
+----
+
+[[Configuringroutestartuporderingandautostartup-Configuringstartingorderforroutes]]
+==== Configuring starting order for routes
+
+You can also configure the order in which routes are started. Previously
+Camel started the routes in a non deterministic order. Now you have fine
+grained control in which order the routes should be started. There is a
+new attribute `startupOrder` which is an `Integer` that states the order.
+Camel then sorts the routes before starting time. The routes with the
+lowest `startupOrder` is started first. All `startupOrder` defined must
+be unique among all routes in your
+link:camelcontext.adoc[CamelContext].
+
+You should also use numbers that are lower than 1000, as routes without
+an explicit `startupOrder` define will have a number starting from 1000
+auto assigned. So view numbers from 1000 upwards as reserved internally
+for Camel itself.
+
+In terms of the `startupOrder` there are no strict rules that it must
+start from 1 and increment by 1. You can for example use: 100, 200, 205,
+89 if you like. Only rule of thumb is that the numbers must be unique.
+
+[[Configuringroutestartuporderingandautostartup-Whydoyouwanttocontrolthestartingorder]]
+==== Why do you want to control the starting order?
+
+It can help in cases where routes are inter dependent on each other and
+also help with graceful shutting down Camel as Camel can stop the routes
+in the correct order as well.
+
+[NOTE]
+====
+**Stopping routes**
+
+*Camel 2.2:* Camel will stop the routes in the *same* order that they
+were started.
+
+*Camel 2.3:* Camel will stop the routes in the *reverse* order that they
+were started.
+====
+
+[[Configuringroutestartuporderingandautostartup-Examples]]
+==== Examples
+
+Let's try a couple of examples.
+
+[[Configuringroutestartuporderingandautostartup-Simpleexample]]
+==== Simple example
+
+[source,java]
+----
+    from("seda:foo").startupOrder(1).to("mock:result");
+    from("direct:start").startupOrder(2).to("seda:foo");
+----
+
+And the same example with XML DSL:
+
+[source,xml]
+----
+    <route startupOrder="1">
+        <from uri="seda:foo"/>
+        <to uri="mock:result"/>
+    </route>
+
+    <route startupOrder="2">
+        <from uri="direct:start"/>
+        <to uri="seda:foo"/>
+    </route>
+----
+
+In this example we have two routes in which we have started that the
+`direct:start` route should be started *after* the `seda:foo` route. +
+As `direct:start` is consider the input and we want that `seda:foo`
+route to be up and running beforehand.
+
+You can also mix and match routes with and without `startupOrder`
+define.
+
+[[Configuringroutestartuporderingandautostartup-RouteswithstartupOrdermixedwithrouteswithout]]
+===== Routes with startupOrder mixed with routes without
+
+[source,java]
+----
+    from("seda:foo").startupOrder(1).to("mock:result");
+    from("direct:start").startupOrder(2).to("seda:foo");
+
+    from("direct:bar").to("seda:bar");
+----
+
+And the same example with XML DSL:
+
+[source,xml]
+----
+    <route startupOrder="1">
+        <from uri="seda:foo"/>
+        <to uri="mock:result"/>
+    </route>
+
+    <route startupOrder="2">
+        <from uri="direct:start"/>
+        <to uri="seda:foo"/>
+    </route>
+
+    <route>
+        <from uri="direct:bar"/>
+        <to uri="seda:bar"/>
+    </route>
+----
+
+In the route above we have *not* define a `startupOrder` on the last
+route `direct:bar` in which Camel will auto assign a number for it, in
+which this case will be 1000. So therefore the route will be started
+last.
+
+So you can use this to your advantage to only assign a `startupOrder` on
+the routes which really needs it.
+
+[[Configuringroutestartuporderingandautostartup-Shutdown]]
+==== Shutdown
+
+*Camel 2.2:* Camel will shutdown the routes in the *same* order that
+they were started.
+
+*Camel 2.3:* Camel will shutdown the routes in the *reverse* order that
+they were started.
+
+See also link:graceful-shutdown.adoc[Graceful Shutdown].
+
+[[Configuringroutestartuporderingandautostartup-Seealso]]
+==== See also
+
+* link:configuring-camel.adoc[Configuring Camel]
+* link:graceful-shutdown.adoc[Graceful Shutdown]
+* link:user-guide.html[User Guide]
diff --git a/docs/user-manual/modules/ROOT/pages/getting-started.adoc b/docs/user-manual/modules/ROOT/pages/getting-started.adoc
index 8a105cf..4715e4f 100644
--- a/docs/user-manual/modules/ROOT/pages/getting-started.adoc
+++ b/docs/user-manual/modules/ROOT/pages/getting-started.adoc
@@ -24,7 +24,7 @@ Working with CamelContexts and RouteBuilders
 To get started with Camel:
 
 1.  Create a CamelContext.
-2.  Optionally, link:configuring-camel.html[configure components or
+2.  Optionally, link:configuring-camel.adoc[configure components or
 endpoints].
 3.  Add whatever routing rules you wish using the DSL and
 RouteBuilder or using
diff --git a/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc b/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
index b1a3dc1..ff8c232 100644
--- a/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
+++ b/docs/user-manual/modules/ROOT/pages/graceful-shutdown.adoc
@@ -128,7 +128,7 @@ context.getShutdownStrategy().setLogInflightExchangesOnTimeout(false);
 You can configure the order in which routes should be started, and thus
 also the same order they are being shutdown. 
  See more at
-link:configuring-route-startup-ordering-and-autostartup.html[Configuring
+link:configuring-route-startup-ordering-and-autostartup.adoc[Configuring
 route startup ordering and autostartup].
 
 [[GracefulShutdown-Finegrainedconfiguration]]
@@ -463,7 +463,7 @@ option. See `GenericFileConsumer` for an example.
 [[GracefulShutdown-SeeAlso]]
 ==== See Also
 
-* link:configuring-route-startup-ordering-and-autostartup.html[Configuring
+* link:configuring-route-startup-ordering-and-autostartup.adoc[Configuring
 route startup ordering and autostartup]
 * link:advanced-configuration-of-camelcontext-using-spring.html[Advanced
 configuration of CamelContext using Spring]


[camel] 03/03: camel-restlet - Fix admonition style in doc

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 8c9db4dddea66bd883267365026302e04583f65b
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Dec 13 19:01:59 2018 +0900

    camel-restlet - Fix admonition style in doc
    
    (cherry picked from commit 282c2247e73c86d2f4000db2910029e8efe1a279)
---
 components/camel-restlet/src/main/docs/restlet-component.adoc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/components/camel-restlet/src/main/docs/restlet-component.adoc b/components/camel-restlet/src/main/docs/restlet-component.adoc
index 2a8888c..ecd96f1 100644
--- a/components/camel-restlet/src/main/docs/restlet-component.adoc
+++ b/components/camel-restlet/src/main/docs/restlet-component.adoc
@@ -41,13 +41,11 @@ a number of protocols. However, we have tested the HTTP protocol only.
 The default port is port 80. We do not automatically switch default port
 based on the protocol yet.
 
-You can append query options to the URI in the following format,
+You can append query options to the URI in the following format:
 `?option=value&option=value&...`
 
- 
-
-INFO: It seems Restlet is case sensitive in understanding headers. For example
-to use content-type, use Content-Type, and for location use Location and
+NOTE: It seems Restlet is case sensitive in understanding headers. For example
+to use content-type, use `Content-Type`, and for location use `Location` and
 so on.
 
 WARNING: We have received a report about drop in performance in camel-restlet in