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 a3bffefd6e5 CAMEL-20067: camel-core - Add debuggingStandby option
a3bffefd6e5 is described below
commit a3bffefd6e5feff96f3528a86ada05bbebcc9c24
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 17 15:20:02 2023 +0100
CAMEL-20067: camel-core - Add debuggingStandby option
---
core/camel-spring-boot/src/main/docs/spring-boot.json | 7 +++++++
.../spring/boot/debug/CamelDebugAutoConfiguration.java | 11 ++++++++---
.../boot/debug/CamelDebugConfigurationProperties.java | 14 ++++++++++++++
3 files changed, 29 insertions(+), 3 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 ec8b062dab6..14196e6888a 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -494,6 +494,13 @@
"sourceType":
"org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties",
"defaultValue": false
},
+ {
+ "name": "camel.debug.standby",
+ "type": "java.lang.Boolean",
+ "description": "To set the debugger in standby mode, where the debugger
will be installed by not automatic enabled. The debugger can then later be
enabled explicit from Java, JMX or tooling.",
+ "sourceType":
"org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties",
+ "defaultValue": false
+ },
{
"name": "camel.debug.wait-for-attach",
"type": "java.lang.Boolean",
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java
index 8873d8c1b5f..906857178ee 100644
---
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java
@@ -35,7 +35,7 @@ public class CamelDebugAutoConfiguration {
@Bean
public BacklogDebugger backlogDebugger(CamelContext camelContext,
CamelDebugConfigurationProperties config) throws Exception {
- if (!config.isEnabled()) {
+ if (!config.isEnabled() && !config.isStandby()) {
return null;
}
@@ -43,9 +43,11 @@ public class CamelDebugAutoConfiguration {
camelContext.setSourceLocationEnabled(true);
// enable debugger on camel
- camelContext.setDebugging(true);
+ camelContext.setDebugging(config.isEnabled());
+ camelContext.setDebugStandby(config.isStandby());
BacklogDebugger debugger =
DefaultBacklogDebugger.createDebugger(camelContext);
+ debugger.setStandby(config.isStandby());
debugger.setInitialBreakpoints(config.getBreakpoints());
debugger.setSingleStepIncludeStartEnd(config.isSingleStepIncludeStartEnd());
debugger.setBodyMaxChars(config.getBodyMaxChars());
@@ -61,7 +63,10 @@ public class CamelDebugAutoConfiguration {
camelContext.addLifecycleStrategy(new LifecycleStrategySupport() {
@Override
public void onContextStarted(CamelContext context) {
- debugger.enableDebugger();
+ // only enable debugger if not in standby mode
+ if (!debugger.isStandby()) {
+ debugger.enableDebugger();
+ }
}
@Override
diff --git
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java
index 4402b335065..329f729e100 100644
---
a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java
+++
b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java
@@ -28,6 +28,12 @@ public class CamelDebugConfigurationProperties {
*/
private boolean enabled;
+ /**
+ * To set the debugger in standby mode, where the debugger will be
installed by not automatic enabled. The debugger
+ * can then later be enabled explicit from Java, JMX or tooling.
+ */
+ private boolean standby;
+
/**
* Whether the debugger should suspend on startup, and wait for a remote
debugger to attach. This is what the IDEA
* and VSCode tooling is using.
@@ -97,6 +103,14 @@ public class CamelDebugConfigurationProperties {
this.enabled = enabled;
}
+ public boolean isStandby() {
+ return standby;
+ }
+
+ public void setStandby(boolean standby) {
+ this.standby = standby;
+ }
+
public boolean isWaitForAttach() {
return waitForAttach;
}