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 09:30:01 UTC

[camel-spring-boot] branch main updated: CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes

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-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new c64705e  CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
c64705e is described below

commit c64705e31e912d012e091299257352025e82b23a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 18 10:29:42 2021 +0100

    CAMEL-16656: camel-core - ResourceReloader SPI - Allow to reload on changes
---
 .../src/main/docs/spring-boot.json                 | 23 ++++++++++++++++++++-
 .../spring/boot/CamelConfigurationProperties.java  | 24 +++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json b/core/camel-spring-boot/src/main/docs/spring-boot.json
index e829082..c8b58df 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -817,7 +817,7 @@
     {
       "name": "camel.springboot.route-filter-exclude-pattern",
       "type": "java.lang.String",
-      "description": "Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression. For example to only include routes which starts with foo in their route id's, use: include=foo&#42; And to exclude routes which starts from JMS endpoints, use: exclude=jms:&#42; Multiple patterns can be separated by comma, for example to exclude b [...]
+      "description": "Used for filtering routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression. For example to only include routes which starts with foo in their route id's, use: include=foo&#42; And to exclude routes which starts from JMS endpoints, use: exclude=jms:&#42; Multiple patterns can be separated by comma, for example to exclude both foo [...]
       "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties"
     },
     {
@@ -847,6 +847,27 @@
       "defaultValue": "classpath:camel\/*,classpath:camel-template\/*,classpath:camel-rest\/*"
     },
     {
+      "name": "camel.springboot.routes-reload-directory",
+      "type": "java.lang.String",
+      "description": "Directory to scan (incl subdirectories) for route changes. Camel cannot scan the classpath, so this must be configured to a file directory. Development with Maven as build tool, you can configure the directory to be src\/main\/resources to scan for Camel routes in XML or YAML files.",
+      "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
+      "defaultValue": "src\/main\/resources"
+    },
+    {
+      "name": "camel.springboot.routes-reload-enabled",
+      "type": "java.lang.Boolean",
+      "description": "Used for enabling automatic routes reloading. If enabled then Camel will watch for file changes in the given reload directory, and trigger reloading routes if files are changed.",
+      "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
+      "defaultValue": false
+    },
+    {
+      "name": "camel.springboot.routes-reload-pattern",
+      "type": "java.lang.String",
+      "description": "Used for inclusive filtering of routes from directories. Typical used for specifying to accept routes in XML or YAML files. Multiple patterns can be specified separated by comma.",
+      "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
+      "defaultValue": "camel\/*"
+    },
+    {
       "name": "camel.springboot.shutdown-log-inflight-exchanges-on-timeout",
       "type": "java.lang.Boolean",
       "description": "Sets whether to log information about the inflight Exchanges which are still running during a shutdown which didn't complete without the given timeout. This requires to enable the option inflightRepositoryExchangeEnabled.",
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index b9cc9b6..113ddf2 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
@@ -20,6 +20,7 @@ import org.apache.camel.LoggingLevel;
 import org.apache.camel.ManagementStatisticsLevel;
 import org.apache.camel.StartupSummaryLevel;
 import org.apache.camel.main.DefaultConfigurationProperties;
+import org.apache.camel.spi.Metadata;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
 import java.util.Map;
@@ -165,7 +166,7 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
     private String routeFilterIncludePattern;
 
     /**
-     * Used for filtering routes routes matching the given pattern, which follows the following rules:
+     * Used for filtering routes matching the given pattern, which follows the following rules:
      *
      * - Match by route id
      * - Match by route input endpoint uri
@@ -182,6 +183,27 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
     private String routeFilterExcludePattern;
 
     /**
+     * Used for enabling automatic routes reloading. If enabled then Camel will watch for file changes in the given
+     * reload directory, and trigger reloading routes if files are changed.
+     */
+    private boolean routesReloadEnabled;
+
+    /**
+     * Directory to scan (incl subdirectories) for route changes. Camel cannot scan the classpath, so this must be
+     * configured to a file directory. Development with Maven as build tool, you can configure the directory to be
+     * src/main/resources to scan for Camel routes in XML or YAML files.
+     */
+    private String routesReloadDirectory = "src/main/resources";
+
+    /**
+     * Used for inclusive filtering of routes from directories.
+     *
+     * Typical used for specifying to accept routes in XML or YAML files.
+     * Multiple patterns can be specified separated by comma.
+     */
+    private String routesReloadPattern = "camel/*";
+
+    /**
      * To specify for how long time in seconds to keep running the JVM before automatic terminating the JVM.
      * You can use this to run Spring Boot for a short while.
      */