This is an automated email from the ASF dual-hosted git repository.

ffang 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 a242355cf28 [CAMEL-21302]only set 
ExchangePropertyKey.CLOSE_CLIENT_SCOPE property when tracing is enabled and 
remove it after endScope
a242355cf28 is described below

commit a242355cf28ab944b71583ea4d1a67db7a0a50ba
Author: Freeman Fang <[email protected]>
AuthorDate: Tue Oct 22 12:25:41 2024 -0400

    [CAMEL-21302]only set ExchangePropertyKey.CLOSE_CLIENT_SCOPE property when 
tracing is enabled and remove it after endScope
---
 .../main/java/org/apache/camel/component/direct/DirectProducer.java   | 4 +++-
 .../src/main/java/org/apache/camel/tracing/ActiveSpanManager.java     | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-direct/src/main/java/org/apache/camel/component/direct/DirectProducer.java
 
b/components/camel-direct/src/main/java/org/apache/camel/component/direct/DirectProducer.java
index 221cb70ef1e..c1ff8d6a706 100644
--- 
a/components/camel-direct/src/main/java/org/apache/camel/component/direct/DirectProducer.java
+++ 
b/components/camel-direct/src/main/java/org/apache/camel/component/direct/DirectProducer.java
@@ -96,7 +96,9 @@ public class DirectProducer extends DefaultAsyncProducer {
                 } else {
                     //Ensure we can close the CLIENT Scope created by this 
DirectProducer
                     //in the same thread
-                    
exchange.setProperty(ExchangePropertyKey.CLOSE_CLIENT_SCOPE, Boolean.TRUE);
+                    if (exchange.getProperty(ExchangePropertyKey.ACTIVE_SPAN) 
!= null) {
+                        
exchange.setProperty(ExchangePropertyKey.CLOSE_CLIENT_SCOPE, Boolean.TRUE);
+                    }
                     return consumer.getAsyncProcessor().process(exchange, 
callback);
                 }
             }
diff --git 
a/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
 
b/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
index db4ac8b73d6..db2ba8a59ae 100644
--- 
a/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
+++ 
b/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
@@ -61,7 +61,7 @@ public final class ActiveSpanManager {
             //DirectProducer in async mode before we create a new INTERNAL 
scope
             //for the next DirectConsumer
             endScope(exchange);
-            exchange.setProperty(ExchangePropertyKey.CLOSE_CLIENT_SCOPE, 
Boolean.FALSE);
+            exchange.removeProperty(ExchangePropertyKey.CLOSE_CLIENT_SCOPE);
         }
         exchange.setProperty(ExchangePropertyKey.ACTIVE_SPAN,
                 new 
Holder(exchange.getProperty(ExchangePropertyKey.ACTIVE_SPAN, Holder.class), 
span));

Reply via email to