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 2026/05/18 14:52:14 UTC

(camel) 24/39: Simplify rest-openapi mock tracing: use getContextPlugin(SyntheticBacklogTracer.class)

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

davsclaus pushed a commit to branch feat/camel-tui
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 95c88d14046a6b44cb1cb562361e80d4cee42dc9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon May 18 12:50:11 2026 +0200

    Simplify rest-openapi mock tracing: use getContextPlugin(SyntheticBacklogTracer.class)
    
    DefaultContextPluginManager.getContextPlugin() falls back to isInstance() checks,
    so SyntheticBacklogTracer.class resolves to the BacklogTracer impl directly.
    No explicit instanceof cast needed in the caller.
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
index 7c289178a13b..ebf6c45b4d5f 100644
--- a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
+++ b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
@@ -41,7 +41,6 @@ import org.apache.camel.NonManagedService;
 import org.apache.camel.Route;
 import org.apache.camel.component.platform.http.PlatformHttpComponent;
 import org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware;
-import org.apache.camel.spi.BacklogTracer;
 import org.apache.camel.spi.PackageScanResourceResolver;
 import org.apache.camel.spi.ProducerCache;
 import org.apache.camel.spi.Resource;
@@ -211,9 +210,8 @@ public class DefaultRestOpenapiProcessorStrategy extends ServiceSupport
                         exchange.setRouteStop(true);
                     } else if ("mock".equalsIgnoreCase(missingOperation)) {
                         // no route then try to load mock data as the answer
-                        BacklogTracer bt = camelContext.getCamelContextExtension().getContextPlugin(BacklogTracer.class);
                         SyntheticBacklogTracer syntheticTracer
-                                = bt instanceof SyntheticBacklogTracer s ? s : null;
+                                = camelContext.getCamelContextExtension().getContextPlugin(SyntheticBacklogTracer.class);
                         NamedNode mockNode = new MockOperationNode(verb, path, operation.getOperationId());
                         if (syntheticTracer != null && (syntheticTracer.isEnabled() || syntheticTracer.isStandby())) {
                             syntheticTracer.traceFirstNode(mockNode, exchange);