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 2021/11/18 10:48:17 UTC

[camel] branch main updated (d8999df -> a41b6ae)

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

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


    from d8999df  CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
     new dab6bfd  CAMEL-17206: camel-kamelet-main - Add support for route reload
     new a41b6ae  CAMEL-17206: camel-jbang - Add reload option to enable live reload of routes when updated/saved.

The 2 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:
 .../modules/ROOT/pages/camel-jbang.adoc            | 24 +++++++++++++++++++++-
 .../apache/camel/dsl/jbang/core/commands/Run.java  |  6 ++++++
 .../java/org/apache/camel/main/KameletMain.java    |  8 +++++++-
 3 files changed, 36 insertions(+), 2 deletions(-)

[camel] 02/02: CAMEL-17206: camel-jbang - Add reload option to enable live reload of routes when updated/saved.

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

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

commit a41b6ae1491e18e1e0775c06e3abda7c72014f06
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 11:46:27 2021 +0100

    CAMEL-17206: camel-jbang - Add reload option to enable live reload of routes when updated/saved.
---
 .../modules/ROOT/pages/camel-jbang.adoc            | 24 +++++++++++++++++++++-
 .../apache/camel/dsl/jbang/core/commands/Run.java  |  6 ++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index b26f7ad..d85cdaa 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -12,13 +12,22 @@ The CamelJBang supports multiple commands. Running the command below, will print
 
 [source,bash]
 ----
-jbang -Dcamel.jbang.version=3.13.0 CamelJBang@apache/camel [command]
+jbang CamelJBang@apache/camel [command]
 ----
 
 *Note*: the first time you run this command, it may cause dependencies to be cached, therefore taking a few extra seconds to run.
 
 All the commands support the `--help` and will display the appropriate help if that flag is provided.
 
+=== Using a specific Camel version
+
+You can specify which Camel version to run as shown:
+
+[source,bash]
+----
+jbang -Dcamel.jbang.version=3.13.0 CamelJBang@apache/camel [command]
+----
+
 === Search
 
 You can use the CLI to search for kamelets, components, languages and miscelaneous components (others). Running the following command will present a list of items that can be searched:
@@ -120,6 +129,7 @@ In order to do so, write a YAML-based file with the `route`, the `steps` and the
 [source,yaml]
 ----
 - route:
+    id: "hello"
     from:
       uri: "kamelet:timer-source"
       parameters:
@@ -143,6 +153,18 @@ jbang -Dcamel.jbang.version=3.13.0 CamelJBang@apache/camel run jms-amqp-10-sink-
 
 NOTE: it is necessary to have a AMQP 1.0 broker, such as Apache Artemis, running locally and listening on port 61616. Adjust the route accordingly if using a different address for the broker.
 
+=== Live reload
+
+You can enable live reload of the route(s) when the source file is updated (saved),
+using the `--reload` options as shown:
+
+[source,bash]
+----
+jbang -Dcamel.jbang.version=3.13.0 CamelJBang@apache/camel run jms-amqp-10-sink-binding.yaml --reload
+----
+
+Then while the Camel application is running, you can update the YAML route and update when saving.
+
 
 == Installation
 
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index b8c3a0b..1330c3f 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -50,6 +50,9 @@ class Run implements Callable<Integer> {
     @Option(names = { "--max-messages" }, defaultValue = "0", description = "Max number of messages to process before stopping")
     private int maxMessages;
 
+    @Option(names = { "--reload" }, description = "Enables live reload when source file is changed (saved)")
+    private boolean reload;
+
     class ShutdownRoute extends RouteBuilder {
         private File lockFile;
 
@@ -97,6 +100,9 @@ class Run implements Callable<Integer> {
         }
 
         System.setProperty("camel.main.routes-include-pattern", "file:" + binding);
+        System.setProperty("camel.main.routes-reload-enabled", reload ? "true" : "false");
+        System.setProperty("camel.main.routes-reload-directory", ".");
+        System.setProperty("camel.main.routes-reload-pattern", binding);
 
         RuntimeUtil.configureLog(debugLevel);
 

[camel] 01/02: CAMEL-17206: camel-kamelet-main - Add support for route reload

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

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

commit dab6bfd55e015ee93142b91d2aa3f4704b9f17a1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 11:28:46 2021 +0100

    CAMEL-17206: camel-kamelet-main - Add support for route reload
---
 .../src/main/java/org/apache/camel/main/KameletMain.java          | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index c656375..854c5f8 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -148,7 +148,13 @@ public class KameletMain extends MainCommandLineSupport {
         answer.setRegistry(registry);
 
         addInitialProperty("camel.component.kamelet.location", "classpath:/kamelets,github:apache:camel-kamelets");
-        addInitialProperty("camel.main.lightweight", "true");
+        addInitialProperty("camel.main.routes-reload-enabled", "true");
+        addInitialProperty("camel.main.routes-reload-directory", "src/main/resources");
+        addInitialProperty("camel.main.routes-reload-pattern", "camel/*.yaml");
+        // turn off lightweight as we have routes reload enabled
+        addInitialProperty("camel.main.lightweight", "false");
+        // shutdown quickly
+        addInitialProperty("camel.main.shutdown-timeout", "5");
 
         if (download) {
             try {