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/12/21 06:02:14 UTC

[camel] 01/02: CAMEL-17359: camel-debug - JAR to make camel debugging easier from tooling

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

commit 9784f0d6d5f40b5f35b3a54099dc343e66aabfb0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 21 06:51:48 2021 +0100

    CAMEL-17359: camel-debug - JAR to make camel debugging easier from tooling
---
 components/camel-debug/src/main/docs/debug.adoc                  | 4 +++-
 .../org/apache/camel/impl/debugger/CamelDebuggerFactory.java     | 1 -
 .../java/org/apache/camel/impl/engine/AbstractCamelContext.java  | 2 +-
 .../org/apache/camel/main/DefaultConfigurationConfigurer.java    | 9 ++++++---
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/components/camel-debug/src/main/docs/debug.adoc b/components/camel-debug/src/main/docs/debug.adoc
index 1bc140e..54f16c7 100644
--- a/components/camel-debug/src/main/docs/debug.adoc
+++ b/components/camel-debug/src/main/docs/debug.adoc
@@ -11,6 +11,8 @@
 The camel-debug enables Camel debugger for 3rd party tooling.
 This makes it easier to perform debugging in IDEs such as IDEA, Eclipse, VSCode
 
+IMPORTANT: The camel-debug is only for development purposes, it should **not** be used for production.
+
 == Auto-detection from classpath
 
 To use this implementation all you need to do is to add the `camel-debug` dependency to the classpath,
@@ -18,5 +20,5 @@ and Camel should auto-detect this on startup and log as follows:
 
 [source,text]
 ----
-Detected and enabling Camel Debugging
+Detected: camel-debug JAR (enabling Camel Debugging)
 ----
diff --git a/components/camel-debug/src/main/java/org/apache/camel/impl/debugger/CamelDebuggerFactory.java b/components/camel-debug/src/main/java/org/apache/camel/impl/debugger/CamelDebuggerFactory.java
index a1f4fd9..5bd2f54 100644
--- a/components/camel-debug/src/main/java/org/apache/camel/impl/debugger/CamelDebuggerFactory.java
+++ b/components/camel-debug/src/main/java/org/apache/camel/impl/debugger/CamelDebuggerFactory.java
@@ -34,7 +34,6 @@ public class CamelDebuggerFactory implements DebuggerFactory {
         BacklogDebugger backlog = BacklogDebugger.createDebugger(camelContext);
         // we need to enable debugger after context is started
         camelContext.adapt(ExtendedCamelContext.class).addLifecycleStrategy(new LifecycleStrategySupport() {
-
             @Override
             public void onContextStarted(CamelContext context) {
                 backlog.enableDebugger();
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index 8143171..02aeae9 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -4122,7 +4122,7 @@ public abstract class AbstractCamelContext extends BaseService
                 DebuggerFactory df
                         = getBootstrapFactoryFinder().newInstance(Debugger.FACTORY, DebuggerFactory.class).orElse(null);
                 if (df != null) {
-                    LOG.info("Detected: {} enabling Camel Debugging", df);
+                    LOG.info("Detected: {} JAR (enabling Camel Debugging)", df);
                     setDebugging(true);
                     Debugger debugger = df.createDebugger(this);
                     if (debugger != null) {
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
index 43b7952..2476d46 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
@@ -213,7 +213,6 @@ public final class DefaultConfigurationConfigurer {
             LOG.warn("Using OffUuidGenerator (Only intended for development purposes)");
         }
 
-        camelContext.setMessageHistory(config.isMessageHistory());
         camelContext.setLogMask(config.isLogMask());
         camelContext.setLogExhaustedMessageBody(config.isLogExhaustedMessageBody());
         camelContext.setAutoStartup(config.isAutoStartup());
@@ -259,11 +258,15 @@ public final class DefaultConfigurationConfigurer {
         camelContext.getGlobalEndpointConfiguration().setBridgeErrorHandler(config.isEndpointBridgeErrorHandler());
         camelContext.getGlobalEndpointConfiguration().setLazyStartProducer(config.isEndpointLazyStartProducer());
 
+        // debug may be enabled via camel-debug JAR on classpath so if config is false (default)
+        // then do not change setting on camel-context
         if (config.isDebugging()) {
-            // debug may be enabled via camel-debug JAR on classpath so if config is false (default)
-            // then do not change setting on camel-context
             camelContext.setDebugging(true);
         }
+        if (config.isMessageHistory()) {
+            camelContext.setMessageHistory(true);
+        }
+
         camelContext.setBacklogTracing(config.isBacklogTracing());
         camelContext.setTracing(config.isTracing());
         camelContext.setTracingStandby(config.isTracingStandby());