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/23 09:26:35 UTC

[camel-spring-boot] branch main updated: CAMEL-17223: camel-main - durationMaxAction to control whether to shutdown or stop all routes.

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 2006bb2  CAMEL-17223: camel-main - durationMaxAction to control whether to shutdown or stop all routes.
2006bb2 is described below

commit 2006bb291b5fd35a7b64157377ba102613cf4b4a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 23 10:26:22 2021 +0100

    CAMEL-17223: camel-main - durationMaxAction to control whether to shutdown or stop all routes.
---
 core/camel-spring-boot/src/main/docs/spring-boot.json              | 7 +++++++
 .../org/apache/camel/spring/boot/CamelConfigurationProperties.java | 6 ++++++
 .../camel/spring/boot/CamelSpringBootApplicationListener.java      | 7 +++++--
 3 files changed, 18 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 1ad8709..6aaf0d2 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -544,6 +544,13 @@
       "defaultValue": false
     },
     {
+      "name": "camel.springboot.duration-max-action",
+      "type": "java.lang.String",
+      "description": "Controls whether the Camel application should shutdown the JVM, or stop all routes, when duration max is triggered.",
+      "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
+      "defaultValue": "shutdown"
+    },
+    {
       "name": "camel.springboot.duration-max-idle-seconds",
       "type": "java.lang.Integer",
       "description": "To specify for how long time in seconds Camel can be idle 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/CamelConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index f7bca8c..e8e4d74 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
@@ -245,6 +245,12 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
     private int durationMaxMessages;
 
     /**
+     * Controls whether the Camel application should shutdown the JVM, or stop all routes, when duration max is
+     * triggered.
+     */
+    private String durationMaxAction = "shutdown";
+
+    /**
      * Is used to limit the maximum length of the logging Camel message bodies. If the message body
      * is longer than the limit, the log message is clipped. Use -1 to have unlimited length.
      * Use for example 1000 to log at most 1000 characters.
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 cf5ea84..f563cb1 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,8 @@ 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, configurationProperties.isRoutesReloadRestartDuration());
+                            controller.getMainShutdownStrategy(), true, configurationProperties.isRoutesReloadRestartDuration(),
+                            configurationProperties.getDurationMaxAction());
                         // register our event notifier
                         ServiceHelper.startService(notifier);
                         camelContext.getManagementStrategy().addEventNotifier(notifier);
@@ -172,7 +173,9 @@ public class CamelSpringBootApplicationListener implements ApplicationListener<C
                             EventNotifier notifier = new MainDurationEventNotifier(camelContext,
                                 configurationProperties.getDurationMaxMessages(),
                                 configurationProperties.getDurationMaxIdleSeconds(),
-                                strategy, false, configurationProperties.isRoutesReloadRestartDuration());
+                                strategy, false,
+                                configurationProperties.isRoutesReloadRestartDuration(),
+                                configurationProperties.getDurationMaxAction());
 
                             // register our event notifier
                             ServiceHelper.startService(notifier);