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/22 10:16:24 UTC

[camel-spring-boot] branch main updated: CAMEL-17215: camel-jbang - Reload should restart max-messages duration

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 cdae280  CAMEL-17215: camel-jbang - Reload should restart max-messages duration
cdae280 is described below

commit cdae2804b047e0d8320e5f492578ba689093729d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Nov 22 11:15:25 2021 +0100

    CAMEL-17215: camel-jbang - Reload should restart max-messages duration
---
 core/camel-spring-boot/src/main/docs/spring-boot.json              | 7 +++++++
 .../org/apache/camel/spring/boot/CamelConfigurationProperties.java | 6 ++++++
 .../camel/spring/boot/CamelSpringBootApplicationListener.java      | 4 ++--
 3 files changed, 15 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 6453476..1ad8709 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -882,6 +882,13 @@
       "defaultValue": true
     },
     {
+      "name": "camel.springboot.routes-reload-restart-duration",
+      "type": "java.lang.Boolean",
+      "description": "Whether to restart max duration when routes are reloaded. For example if max duration is 60 seconds, and a route is reloaded after 25 seconds, then this will restart the count and wait 60 seconds again.",
+      "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
+      "defaultValue": true
+    },
+    {
       "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 0c9fdac..f7bca8c 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
@@ -221,6 +221,12 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
     private boolean routesReloadRemoveAllRoutes = true;
 
     /**
+     * Whether to restart max duration when routes are reloaded. For example if max duration is 60 seconds, and a route
+     * is reloaded after 25 seconds, then this will restart the count and wait 60 seconds again.
+     */
+     private boolean routesReloadRestartDuration = true;
+
+    /**
      * 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.
      */
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationListener.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationListener.java
index 6d3773d..cf5ea84 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationListener.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelSpringBootApplicationListener.java
@@ -123,7 +123,7 @@ public class CamelSpringBootApplicationListener implements ApplicationListener<C
                         // register lifecycle so we can trigger to shutdown the JVM when maximum number of messages has been processed
                         EventNotifier notifier = new MainDurationEventNotifier(camelContext,
                             configurationProperties.getDurationMaxMessages(), configurationProperties.getDurationMaxIdleSeconds(),
-                            controller.getMainShutdownStrategy(), true);
+                            controller.getMainShutdownStrategy(), true, configurationProperties.isRoutesReloadRestartDuration());
                         // register our event notifier
                         ServiceHelper.startService(notifier);
                         camelContext.getManagementStrategy().addEventNotifier(notifier);
@@ -172,7 +172,7 @@ public class CamelSpringBootApplicationListener implements ApplicationListener<C
                             EventNotifier notifier = new MainDurationEventNotifier(camelContext,
                                 configurationProperties.getDurationMaxMessages(),
                                 configurationProperties.getDurationMaxIdleSeconds(),
-                                strategy, false);
+                                strategy, false, configurationProperties.isRoutesReloadRestartDuration());
 
                             // register our event notifier
                             ServiceHelper.startService(notifier);