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 0fa8b471cbda8e68a060d84be165c124b5664c22
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon May 18 13:25:46 2026 +0200

    DefaultRuntimeEndpointRegistry: fall back to inputs scan when fromRouteId 
is null
    
    Some consumers (e.g. platform-http under rest-openapi) produce exchanges 
where
    getFromRouteId() is null, causing asUtilizationKey to return null and the 
hit
    to be silently dropped. When routeId is null, scan the inputs map for the 
route
    that registered this endpoint URI and use that routeId instead.
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
---
 .../camel/impl/engine/DefaultRuntimeEndpointRegistry.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java
index 6598fab2c9a6..ed8044f5ad52 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java
@@ -260,9 +260,17 @@ public class DefaultRuntimeEndpointRegistry extends 
EventNotifierSupport impleme
             if (endpoint != null) {
                 String routeId = ece.getExchange().getFromRouteId();
                 String uri = endpoint.getEndpointUri();
-                // ensure the actual consumer URI is in inputs so 
getEndpointStatistics() can find it;
                 // some components (e.g. rest-openapi) delegate to an 
underlying consumer (e.g. platform-http)
-                // whose endpoint URI differs from the route's logical 
endpoint URI
+                // whose exchange may not carry a fromRouteId; fall back to 
scanning inputs by URI
+                if (routeId == null) {
+                    for (Map.Entry<String, Set<String>> entry : 
inputs.entrySet()) {
+                        if (entry.getValue().contains(uri)) {
+                            routeId = entry.getKey();
+                            break;
+                        }
+                    }
+                }
+                // ensure the actual consumer URI is in inputs so 
getEndpointStatistics() can find it
                 Set<String> routeInputs = inputs.get(routeId);
                 if (routeInputs != null) {
                     routeInputs.add(uri);

Reply via email to