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


The following commit(s) were added to refs/heads/main by this push:
     new 0c925cdc527 CAMEL-20078: camel-jbang - Debug command
0c925cdc527 is described below

commit 0c925cdc52712d0314bc51a0830aeb13f5f4d368
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Nov 4 10:52:03 2023 +0100

    CAMEL-20078: camel-jbang - Debug command
---
 .../src/main/java/org/apache/camel/spi/BacklogDebugger.java       | 8 ++++----
 .../org/apache/camel/impl/debugger/DefaultBacklogDebugger.java    | 4 ++--
 .../main/java/org/apache/camel/impl/engine/DefaultChannel.java    | 4 ++--
 .../resources/META-INF/camel-main-configuration-metadata.json     | 2 +-
 core/camel-main/src/main/docs/main.adoc                           | 2 +-
 .../org/apache/camel/main/DebuggerConfigurationProperties.java    | 4 ++--
 .../main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java | 2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/BacklogDebugger.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/BacklogDebugger.java
index 256178e6084..5b4bef80f76 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/BacklogDebugger.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/BacklogDebugger.java
@@ -52,20 +52,20 @@ public interface BacklogDebugger extends StatefulService {
     String SUSPEND_MODE_SYSTEM_PROP_NAME = "org.apache.camel.debugger.suspend";
 
     /**
-     * Special breakpoint id token to automatically add breakpoint for every 
first node in every route
+     * Special breakpoint id token to automatically add breakpoint for every 
route.
      */
-    String BREAKPOINT_FIRST_ROUTES = "FIRST_ROUTES";
+    String BREAKPOINT_ALL_ROUTES = "route:*";
 
     /**
      * Allows to pre-configure breakpoints (node ids) to use with debugger on 
startup. Multiple ids can be separated by
-     * comma. Use special value FIRST_ROUTES to add a breakpoint for the first 
node for every route, in other words this
+     * comma. Use special value route:* to add a breakpoint for the first node 
for every route, in other words this
      * makes it easy to debug from the beginning of every route without 
knowing the exact node ids.
      */
     String getInitialBreakpoints();
 
     /**
      * Allows to pre-configure breakpoints (node ids) to use with debugger on 
startup. Multiple ids can be separated by
-     * comma. Use special value FIRST_ROUTES to add a breakpoint for the first 
node for every route, in other words this
+     * comma. Use special value route:* to add a breakpoint for the first node 
for every route, in other words this
      * makes it easy to debug from the beginning of every route without 
knowing the exact node ids.
      */
     void setInitialBreakpoints(String initialBreakpoints);
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/DefaultBacklogDebugger.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/DefaultBacklogDebugger.java
index 35618624657..0e9690e8210 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/DefaultBacklogDebugger.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/DefaultBacklogDebugger.java
@@ -723,8 +723,8 @@ public final class DefaultBacklogDebugger extends 
ServiceSupport implements Back
         if (initialBreakpoints != null) {
             for (String b : initialBreakpoints.split(",")) {
                 b = b.trim();
-                if (!DefaultBacklogDebugger.BREAKPOINT_FIRST_ROUTES.equals(b)) 
{
-                    // FIRST_ROUTES are special and handled elsewhere
+                if (!DefaultBacklogDebugger.BREAKPOINT_ALL_ROUTES.equals(b)) {
+                    // BREAKPOINT_ALL_ROUTES are special and handled elsewhere
                     addBreakpoint(b);
                 }
             }
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultChannel.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultChannel.java
index f7cc9a47d64..2d4b23985d9 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultChannel.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultChannel.java
@@ -184,9 +184,9 @@ public class DefaultChannel extends CamelInternalProcessor 
implements Channel {
                 if (!camelContext.hasService(debugger)) {
                     camelContext.addService(debugger);
                 }
-                // if starting breakpoint is FIRST_ROUTES then automatic add 
first as a breakpoint
+                // if starting breakpoint is BREAKPOINT_ALL_ROUTES then 
automatic add first as a breakpoint
                 if (first && debugger.getInitialBreakpoints() != null
-                        && 
debugger.getInitialBreakpoints().contains(BacklogDebugger.BREAKPOINT_FIRST_ROUTES))
 {
+                        && 
debugger.getInitialBreakpoints().contains(BacklogDebugger.BREAKPOINT_ALL_ROUTES))
 {
                     if (debugger.isSingleStepIncludeStartEnd()) {
                         // we want route to be breakpoint (use input)
                         String id = routeDefinition.getInput().getId();
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index aab97f14034..1be0c4a86b8 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -144,7 +144,7 @@
     { "name": "camel.debug.bodyIncludeFiles", "description": "Whether to 
include the message body of file based messages. The overhead is that the file 
content has to be read from the file.", "sourceType": 
"org.apache.camel.main.DebuggerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": true },
     { "name": "camel.debug.bodyIncludeStreams", "description": "Whether to 
include the message body of stream based messages. If enabled then beware the 
stream may not be re-readable later. See more about Stream Caching.", 
"sourceType": "org.apache.camel.main.DebuggerConfigurationProperties", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.debug.bodyMaxChars", "description": "To limit the message 
body to a maximum size in the traced message. Use 0 or negative value to use 
unlimited size.", "sourceType": 
"org.apache.camel.main.DebuggerConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 131072 },
-    { "name": "camel.debug.breakpoints", "description": "Allows to 
pre-configure breakpoints (node ids) to use with debugger on startup. Multiple 
ids can be separated by comma. Use special value FIRST_ROUTES to add a 
breakpoint for the first node for every route, in other words this makes it 
easy to debug from the beginning of every route without knowing the exact node 
ids.", "sourceType": "org.apache.camel.main.DebuggerConfigurationProperties", 
"type": "string", "javaType": "java.lang.S [...]
+    { "name": "camel.debug.breakpoints", "description": "Allows to 
pre-configure breakpoints (node ids) to use with debugger on startup. Multiple 
ids can be separated by comma. Use special value route: to add a breakpoint for 
the first node for every route, in other words this makes it easy to debug from 
the beginning of every route without knowing the exact node ids.", 
"sourceType": "org.apache.camel.main.DebuggerConfigurationProperties", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.debug.enabled", "description": "Enables Debugger in your 
Camel application.", "sourceType": 
"org.apache.camel.main.DebuggerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.debug.includeException", "description": "Trace messages 
to include exception if the message failed", "sourceType": 
"org.apache.camel.main.DebuggerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": true },
     { "name": "camel.debug.includeExchangeProperties", "description": "Whether 
to include the exchange properties in the traced message", "sourceType": 
"org.apache.camel.main.DebuggerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": true },
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index 7bb171761c9..0674c46534a 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -181,7 +181,7 @@ The camel.debug supports 10 options, which are listed below.
 | *camel.debug.bodyIncludeFiles* | Whether to include the message body of file 
based messages. The overhead is that the file content has to be read from the 
file. | true | boolean
 | *camel.debug.bodyIncludeStreams* | Whether to include the message body of 
stream based messages. If enabled then beware the stream may not be re-readable 
later. See more about Stream Caching. | false | boolean
 | *camel.debug.bodyMaxChars* | To limit the message body to a maximum size in 
the traced message. Use 0 or negative value to use unlimited size. | 131072 | 
int
-| *camel.debug.breakpoints* | Allows to pre-configure breakpoints (node ids) 
to use with debugger on startup. Multiple ids can be separated by comma. Use 
special value FIRST_ROUTES to add a breakpoint for the first node for every 
route, in other words this makes it easy to debug from the beginning of every 
route without knowing the exact node ids. |  | String
+| *camel.debug.breakpoints* | Allows to pre-configure breakpoints (node ids) 
to use with debugger on startup. Multiple ids can be separated by comma. Use 
special value route: to add a breakpoint for the first node for every route, in 
other words this makes it easy to debug from the beginning of every route 
without knowing the exact node ids. |  | String
 | *camel.debug.enabled* | Enables Debugger in your Camel application. | false 
| boolean
 | *camel.debug.includeException* | Trace messages to include exception if the 
message failed | true | boolean
 | *camel.debug.includeExchange{zwsp}Properties* | Whether to include the 
exchange properties in the traced message | true | boolean
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/DebuggerConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/DebuggerConfigurationProperties.java
index b48f2d6a8fe..48b2629115c 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/DebuggerConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/DebuggerConfigurationProperties.java
@@ -103,7 +103,7 @@ public class DebuggerConfigurationProperties implements 
BootstrapCloseable {
 
     /**
      * Allows to pre-configure breakpoints (node ids) to use with debugger on 
startup. Multiple ids can be separated by
-     * comma. Use special value FIRST_ROUTES to add a breakpoint for the first 
node for every route, in other words this
+     * comma. Use special value route:* to add a breakpoint for the first node 
for every route, in other words this
      * makes it easy to debug from the beginning of every route without 
knowing the exact node ids.
      */
     public void setBreakpoints(String breakpoints) {
@@ -207,7 +207,7 @@ public class DebuggerConfigurationProperties implements 
BootstrapCloseable {
 
     /**
      * Allows to pre-configure breakpoints (node ids) to use with debugger on 
startup. Multiple ids can be separated by
-     * comma. Use special value FIRST_ROUTES to add a breakpoint for the first 
node for every route, in other words this
+     * comma. Use special value route:* to add a breakpoint for the first node 
for every route, in other words this
      * makes it easy to debug from the beginning of every route without 
knowing the exact node ids.
      */
     public DebuggerConfigurationProperties withBreakpoints(String breakpoints) 
{
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
index 5384eda00e1..8a7a826d334 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
@@ -233,7 +233,7 @@ public class Debug extends Run {
         // enable light-weight debugger (not camel-debug JAR that is for 
IDEA/VSCode tooling with remote JMX)
         cmds.add("--prop=camel.debug.enabled=true");
         if (breakpoint == null) {
-            cmds.add("--prop=camel.debug.breakpoints=FIRST_ROUTES");
+            cmds.add("--prop=camel.debug.breakpoints=route:*");
         } else {
             cmds.add("--prop=camel.debug.breakpoints=" + breakpoint);
         }

Reply via email to