[
https://issues.apache.org/jira/browse/CAMEL-23544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-23544:
-----------------------------------
Assignee: Claus Ibsen
> Fix null fromRouteId and endpoint tracking for delegating consumers (e.g.
> platform-http)
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-23544
> URL: https://issues.apache.org/jira/browse/CAMEL-23544
> Project: Camel
> Issue Type: Bug
> Components: camel-core-api, camel-platform-http, camel-rest-openapi
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
>
> h2. Problem
> Three related issues affect components that delegate to a nested consumer
> (e.g. rest-openapi delegating to platform-http, which delegates to
> VertxPlatformHttpConsumer):
> h3. 1. Null fromRouteId in platform-http exchanges
> {{DefaultPlatformHttpConsumer.doInit()}} creates the nested
> {{VertxPlatformHttpConsumer}} before {{RouteService.doSetup()}} calls
> {{setRouteId()}} on the outer consumer. The nested consumer never receives
> the route ID, so exchanges created by {{VertxPlatformHttpConsumer}} carry a
> null {{fromRouteId}}.
> *Fix:* Override {{setRouteId()}} in {{DefaultPlatformHttpConsumer}} to
> propagate the route ID to the nested consumer whenever it is set:
> {code:java}
> @Override
> public void setRouteId(String routeId) {
> super.setRouteId(routeId);
> if (platformHttpConsumer instanceof RouteIdAware ria) {
> ria.setRouteId(routeId);
> }
> }
> {code}
> h3. 2. DefaultRuntimeEndpointRegistry misses consumer endpoint URIs for
> delegating routes
> When a route uses a logical endpoint URI (e.g. {{rest-openapi://...}}) but
> the actual consumer uses a different URI (e.g. {{platform-http:///path}}),
> the {{RouteAddedEvent}} handler only registered the logical URI in the inputs
> map. ExchangeCreatedEvent hits recorded under the consumer URI were never
> matched, causing TOTAL counts to show 0 in management tooling.
> *Fix:* In the {{RouteAddedEvent}} handler, also add the consumer's endpoint
> URI to the route's input set when it differs from the route endpoint URI. In
> the {{RouteRemovedEvent}} handler, also remove it from {{inputUtilization}}.
> h3. 3. New SyntheticBacklogTracer SPI
> Components that process exchanges inline and bypass the normal route pipeline
> (e.g. mock mode in rest-openapi consumer) cannot rely on
> {{CamelInternalProcessor}} to emit trace events automatically. There was no
> clean API for them to participate in message-history capture.
> *Fix:* Introduce {{org.apache.camel.spi.SyntheticBacklogTracer}} (extends
> {{BacklogTracer}}) with two methods:
> - {{traceFirstNode(NamedNode, Exchange)}} - emits a first=true trace event
> before inline processing
> - {{traceLastNode(NamedNode, Exchange)}} - emits a last=true trace event
> after, triggering message-history completion
> {{BacklogTracer}} impl now implements {{SyntheticBacklogTracer}}. Callers
> look it up via
> {{camelContext.getCamelContextExtension().getContextPlugin(SyntheticBacklogTracer.class)}}.
> h2. Affected files
> -
> {{components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/DefaultPlatformHttpConsumer.java}}
> -
> {{core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java}}
> -
> {{core/camel-api/src/main/java/org/apache/camel/spi/SyntheticBacklogTracer.java}}
> (new)
> -
> {{core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/BacklogTracer.java}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)