This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-23722-cli-docs-restructure in repository https://gitbox.apache.org/repos/asf/camel.git
commit 0ce5a33e9cf441c38a628d0191bc49669b8ec1f2 Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jun 9 18:24:03 2026 +0200 CAMEL-23722: Tighten Debugging page prose Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../modules/ROOT/pages/camel-jbang-debugging.adoc | 87 +++++++++------------- 1 file changed, 35 insertions(+), 52 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-debugging.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-debugging.adoc index 90bc9d006d11..eb07bef9a4f9 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-debugging.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-debugging.adoc @@ -4,16 +4,18 @@ The Camel CLI provides built-in debugging capabilities — from Camel's own rout == Camel route debugging -With *Camel 4.2* onwards you can now easily debug Camel routes from the command shell with the `debug` command as shown below: +*Available since Camel 4.2* + +Debug Camel routes directly from the terminal: [source,bash] ---- camel debug hello.yaml ---- -This will run the integration (in background), and the current shell running in foreground will act as a CLI based debugger. -You can see snippets from the log (in the top), the middle section shown the current breakpoint. -And in the bottom you can see content of the message (similar to the `camel trace` command) +The integration runs in the background while the foreground shell acts as a CLI debugger. +The top shows log output, the middle shows the current breakpoint with source context, +and the bottom shows the message content: [source,text] ---- @@ -50,73 +52,54 @@ Source: foo.camel.yaml:13 Breakpoint suspended. Press ENTER to continue. ---- -This is _basic_ but yet powerful, as you have this debugger always readily available, without having to start up VSCode or IDEA tooling. - === Configuring breakpoints -When using `camel debug` then breakpoints are by default added to every route. -However, you can specify which breakpoints to use instead with the `--breakpoint` option. -This parameter is able to match the Camel routes using a pattern style: +By default, breakpoints are added to every route. Use `--breakpoint` to target specific nodes. +The option supports multiple match styles (comma-separated): -1. Exact match by node ids -2. Match node ids by pattern (wildcard and regular expression) -3. Match by EIP kind (setHeader, setBody, choice, split, etc.) -4. Match by source and line number -5. Match by line number +- Exact or pattern match by node id (wildcard and regex) +- EIP kind (`setHeader`, `setBody`, `choice`, `split`, etc.) +- Source file and/or line number -Multiple breakpoints can be separated by comma. - -For example, to set a breakpoint at the setHeader EIP, you do: +Examples: [source,bash] ---- camel debug hello.yaml --breakpoint=setHeader ----- - -To set a breakpoint at line 18: - -[source,bash] ----- camel debug hello.yaml --breakpoint=18 ----- - -To set a breakpoint at line 18 and 34 - -[source,bash] ----- camel debug hello.yaml --breakpoint=18,34 ---- -=== Camel Spring Boot route debugging +=== Spring Boot route debugging -In *Camel 4.14* we added support for using Camel CLI to debug an existing Camel Spring Boot Maven based project. +*Available since Camel 4.14* -All that is needed is to execute: +Debug an existing Spring Boot Maven project by pointing at its `pom.xml`: [source,bash] ---- camel debug pom.xml ---- -This tells Camel CLI to look inside the Maven pom.xml file and if `camel-spring-boot-bom` is detected, -then Camel CLI will automatically run Spring Boot with debugging enabled. This is done by letting Spring Boot -compile and build a fat-jar, that then is launched in the background and the output is shown in the console; just as shown -above. You will then get the same user experience as debugging plain Camel Main files. - -== Camel route debugging using VSCode or IDEA editors +Camel CLI detects `camel-spring-boot-bom`, builds a fat JAR, and launches it in the background +with debugging enabled — the same experience as debugging plain Camel files. -The Camel route debugger is available by default (the `camel-debug` component is automatically added to the classpath). By default, it can be reached through JMX at the URL `service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel`. +== IDE route debugging -You can then use the Integrated Development Environment (IDE) of your choice. For instance, https://plugins.jetbrains.com/plugin/9371-apache-camel[IntelliJ], https://marketplace.visualstudio.com/items?itemName=redhat.vscode-debug-adapter-apache-camel[VS Code] or https://marketplace.eclipse.org/content/textual-debugging-apache-camel[Eclipse Desktop]. +The Camel route debugger is available by default via JMX at +`service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel`. -A specific how-to is available for VS Code, see this https://youtu.be/owNhWxf42qk[video]. +Supported IDE plugins: +https://plugins.jetbrains.com/plugin/9371-apache-camel[IntelliJ], +https://marketplace.visualstudio.com/items?itemName=redhat.vscode-debug-adapter-apache-camel[VS Code], +https://marketplace.eclipse.org/content/textual-debugging-apache-camel[Eclipse Desktop]. -TIP: When exporting to Maven projects, then you can use the maven profile `camel.debug` that will include the `camel-debug` JAR -to make it possible for Camel IDE tools to do Camel route debugging. +TIP: When exporting to a Maven project, use the `camel.debug` Maven profile to include +the `camel-debug` JAR for IDE-based route debugging. == Java debugging -Camel CLI makes it easy to do _Java debugging_ when you run your integration with the `--jvm-debug` option as shown below: +Use `--jvm-debug` to open a standard Java debug socket (default port 4004): [source,bash] ---- @@ -124,18 +107,18 @@ camel run hello.yaml --jvm-debug Listening for transport dt_socket at address: 4004 ---- -As you can see the default listening port is 4004 but can be configured as described in https://www.jbang.dev/documentation/guide/latest/debugging.html[JBang Debugging]. +Attach from +https://www.jetbrains.com/help/idea/attaching-to-local-process.html#create-rc[IntelliJ], +https://code.visualstudio.com/docs/java/java-debugging#_attach[VS Code], or +https://www.vogella.com/tutorials/EclipseDebugging/article.html#remote-debugging[Eclipse]. +Port configuration is described in the https://www.jbang.dev/documentation/guide/latest/debugging.html[JBang Debugging] guide. -This is a standard Java debug socket. You can then use the IDE of your choice. For instance, see the generic documentation for https://www.jetbrains.com/help/idea/attaching-to-local-process.html#create-rc[IntelliJ], https://code.visualstudio.com/docs/java/java-debugging#_attach[VS Code] and https://www.vogella.com/tutorials/EclipseDebugging/article.html#remote-debugging[Eclipse Desktop]. You will surely want to add `Processor` to be able to put breakpoints hit during route execution (as [...] +=== JBang-level debugging -=== Standard JBang debugging - -You can debug your integration scripts by making use of the `--debug` flag provided by JBang. +Use JBang's `--debug` flag to debug any CLI command (not just `run`): [source,bash] ---- -jbang --debug camel@apache/camel run hello.yaml +jbang --debug camel@apache/camel run hello.yaml Listening for transport dt_socket at address: 4004 ---- - -This makes it possible to debug any of the Camel CLI commands, not only the `run` command as shown above.
