This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch deb in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit 05cb736504a9943154160f3a9b6e178694fef88e Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun May 12 10:32:48 2024 +0200 CAMEL-20758: camel-spring-boot - Debugger is created twice --- .../camel-debug-starter/src/main/docs/debug.json | 114 ++++++++++++++++++--- .../boot/debug/CamelDebugAutoConfiguration.java | 5 + .../debug/CamelDebugConfigurationProperties.java | 0 ...rk.boot.autoconfigure.AutoConfiguration.imports | 18 ++++ .../src/main/docs/spring-boot.json | 94 ----------------- ...rk.boot.autoconfigure.AutoConfiguration.imports | 1 - 6 files changed, 123 insertions(+), 109 deletions(-) diff --git a/components-starter/camel-debug-starter/src/main/docs/debug.json b/components-starter/camel-debug-starter/src/main/docs/debug.json index f0caf83295a..8a6dfa969ed 100644 --- a/components-starter/camel-debug-starter/src/main/docs/debug.json +++ b/components-starter/camel-debug-starter/src/main/docs/debug.json @@ -1,15 +1,101 @@ { - "other": { - "kind": "other", - "name": "debug", - "title": "Debug", - "description": "Enables Camel Route Debugging", - "deprecated": false, - "firstVersion": "3.15.0", - "label": "tooling", - "supportLevel": "Stable", - "groupId": "org.apache.camel.springboot", - "artifactId": "camel-debug-starter", - "version": "4.7.0-SNAPSHOT" - } -} + "groups": [ + { + "name": "camel.debug", + "type": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties" + } + ], + "properties": [ + { + "name": "camel.debug.body-include-files", + "type": "java.lang.Boolean", + "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.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": true + }, + { + "name": "camel.debug.body-include-streams", + "type": "java.lang.Boolean", + "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.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": false + }, + { + "name": "camel.debug.body-max-chars", + "type": "java.lang.Integer", + "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.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": 0 + }, + { + "name": "camel.debug.breakpoints", + "type": "java.lang.String", + "description": "Allows to pre-configure breakpoints (node ids) to use with debugger on startup. Multiple ids can be separated by comma. Use special value _all_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.spring.boot.debug.CamelDebugConfigurationProperties" + }, + { + "name": "camel.debug.enabled", + "type": "java.lang.Boolean", + "description": "Enables Debugger in your Camel application.", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": false + }, + { + "name": "camel.debug.fallback-timeout", + "type": "java.lang.Long", + "description": "Fallback Timeout in seconds (300 seconds as default) when block the message processing in Camel. A timeout used for waiting for a message to arrive at a given breakpoint.", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": 300 + }, + { + "name": "camel.debug.include-exception", + "type": "java.lang.Boolean", + "description": "Trace messages to include exception if the message failed", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": true + }, + { + "name": "camel.debug.include-exchange-properties", + "type": "java.lang.Boolean", + "description": "Whether to include the exchange properties in the traced message", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": true + }, + { + "name": "camel.debug.include-exchange-variables", + "type": "java.lang.Boolean", + "description": "Whether to include the exchange variables in the traced message", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": true + }, + { + "name": "camel.debug.logging-level", + "type": "org.apache.camel.LoggingLevel", + "description": "The debugger logging level to use when logging activity.", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties" + }, + { + "name": "camel.debug.single-step-include-start-end", + "type": "java.lang.Boolean", + "description": "In single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming\/complete exchange at the route (you can see message body as response, failed exception etc).", + "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", + "description": "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.", + "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", + "defaultValue": false + } + ], + "hints": [] +} \ No newline at end of file diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java b/components-starter/camel-debug-starter/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java similarity index 94% rename from core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java rename to components-starter/camel-debug-starter/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java index 0cb39dfc17e..87d001aae49 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java +++ b/components-starter/camel-debug-starter/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugAutoConfiguration.java @@ -17,6 +17,7 @@ package org.apache.camel.spring.boot.debug; import org.apache.camel.CamelContext; +import org.apache.camel.component.debug.JmxConnectorService; import org.apache.camel.impl.debugger.DefaultBacklogDebugger; import org.apache.camel.spi.BacklogDebugger; import org.apache.camel.spring.boot.CamelAutoConfiguration; @@ -36,6 +37,7 @@ public class CamelDebugAutoConfiguration { @Bean public BacklogDebugger backlogDebugger(CamelContext camelContext, CamelDebugConfigurationProperties config) throws Exception { + if (!config.isEnabled() && !config.isStandby()) { return null; } @@ -77,6 +79,9 @@ public class CamelDebugAutoConfiguration { } }); + // to make debugging possible for tooling we need to make it possible to do remote JMX connection + camelContext.addService(new JmxConnectorService()); + camelContext.addService(debugger); return debugger; diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java b/components-starter/camel-debug-starter/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java similarity index 100% rename from core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java rename to components-starter/camel-debug-starter/src/main/java/org/apache/camel/spring/boot/debug/CamelDebugConfigurationProperties.java diff --git a/components-starter/camel-debug-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/components-starter/camel-debug-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000000..efb491ebc7d --- /dev/null +++ b/components-starter/camel-debug-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +org.apache.camel.spring.boot.debug.CamelDebugAutoConfiguration 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 c069d4d09d9..1d80c91afb2 100644 --- a/core/camel-spring-boot/src/main/docs/spring-boot.json +++ b/core/camel-spring-boot/src/main/docs/spring-boot.json @@ -78,11 +78,6 @@ "sourceType": "org.apache.camel.spring.boot.DataFormatConfigurationProperties", "sourceMethod": "getCustomizer()" }, - { - "name": "camel.debug", - "type": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties" - }, { "name": "camel.health", "type": "org.apache.camel.spring.boot.actuate.health.CamelHealthCheckConfigurationProperties", @@ -448,95 +443,6 @@ "sourceType": "org.apache.camel.spring.boot.DataFormatConfigurationProperties", "defaultValue": true }, - { - "name": "camel.debug.body-include-files", - "type": "java.lang.Boolean", - "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.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": true - }, - { - "name": "camel.debug.body-include-streams", - "type": "java.lang.Boolean", - "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.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": false - }, - { - "name": "camel.debug.body-max-chars", - "type": "java.lang.Integer", - "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.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": 0 - }, - { - "name": "camel.debug.breakpoints", - "type": "java.lang.String", - "description": "Allows to pre-configure breakpoints (node ids) to use with debugger on startup. Multiple ids can be separated by comma. Use special value _all_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.spring.boot.debug.CamelDebugConfigurationProperties" - }, - { - "name": "camel.debug.enabled", - "type": "java.lang.Boolean", - "description": "Enables Debugger in your Camel application.", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": false - }, - { - "name": "camel.debug.fallback-timeout", - "type": "java.lang.Long", - "description": "Fallback Timeout in seconds (300 seconds as default) when block the message processing in Camel. A timeout used for waiting for a message to arrive at a given breakpoint.", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": 300 - }, - { - "name": "camel.debug.include-exception", - "type": "java.lang.Boolean", - "description": "Trace messages to include exception if the message failed", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": true - }, - { - "name": "camel.debug.include-exchange-properties", - "type": "java.lang.Boolean", - "description": "Whether to include the exchange properties in the traced message", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": true - }, - { - "name": "camel.debug.include-exchange-variables", - "type": "java.lang.Boolean", - "description": "Whether to include the exchange variables in the traced message", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": true - }, - { - "name": "camel.debug.logging-level", - "type": "org.apache.camel.LoggingLevel", - "description": "The debugger logging level to use when logging activity.", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties" - }, - { - "name": "camel.debug.single-step-include-start-end", - "type": "java.lang.Boolean", - "description": "In single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming\/complete exchange at the route (you can see message body as response, failed exception etc).", - "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", - "description": "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.", - "sourceType": "org.apache.camel.spring.boot.debug.CamelDebugConfigurationProperties", - "defaultValue": false - }, { "name": "camel.health.async-camel-health-check", "type": "java.lang.Boolean", diff --git a/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 98002faf2f0..30f28a88919 100644 --- a/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/core/camel-spring-boot/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -29,7 +29,6 @@ org.apache.camel.spring.boot.cloud.CamelCloudServiceDiscoveryAutoConfiguration org.apache.camel.spring.boot.cloud.CamelCloudServiceFilterAutoConfiguration org.apache.camel.spring.boot.cloud.CamelCloudServiceChooserAutoConfiguration org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration -org.apache.camel.spring.boot.debug.CamelDebugAutoConfiguration org.apache.camel.spring.boot.properties.PropertiesComponentAutoConfiguration org.apache.camel.spring.boot.routecontroller.SupervisingRouteControllerAutoConfiguration org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration