Fix rest-cxf-opentelemetry example: use CamelCxfOperationName, migrate to camel-opentelemetry2 - #209
Open
Croway wants to merge 1 commit into
Open
Fix rest-cxf-opentelemetry example: use CamelCxfOperationName, migrate to camel-opentelemetry2#209Croway wants to merge 1 commit into
Croway wants to merge 1 commit into
Conversation
…grate to camel-opentelemetry2
Same bug as the plain rest-cxf example, replicated across all 3 services
(random/even/odd): CamelRouter routed on ${header.operationName}, which
CXF-RS never sets, instead of ${header.CamelCxfOperationName} which
DefaultCxfRsBinding actually populates. Every REST call hit
MethodNotFoundException (500).
Also migrate off camel-opentelemetry (v1), which logs a deprecation
warning, to camel-opentelemetry2 - swap the starter artifactId and the
@CamelOpenTelemetry annotation for @CamelOpenTelemetry2 in each service's
Application class, matching the convention already used by the sibling
opentelemetry/*Booking examples.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JvQJNT1UYzqUm5HQtkL6Nu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Same underlying bug as #206 (
rest-cxf), replicated across all 3 services in this example:random,even, andoddCamelRouters each dispatched on${header.operationName}, a header CXF-RS never sets.DefaultCxfRsBindingactually populatesCamelCxfOperationNamefor every cxfrs request regardless of binding style, so the header resolved empty and every REST call hitbean:...ServiceImpl?method=with a blank method name, throwingMethodNotFoundException(500).${header.CamelCxfOperationName}in all three modules (kept the existingtoDdispatch style already used here, consistent with Fix rest-cxf example: use CamelCxfOperationName for dynamic bean dispatch #206).Additionally,
camel-opentelemetry(v1) logs a deprecation warning suggestingcamel-opentelemetry2. Migrated all 3 services:camel-opentelemetry-starter→camel-opentelemetry2-starterinrest-cxf-opentelemetry/pom.xml.@CamelOpenTelemetry→@CamelOpenTelemetry2(and the corresponding import) in each service'sApplicationclass.opentelemetry/*Bookingexamples in this repo, which are already oncamel-opentelemetry2-starter.The OTel javaagent (2.19.0) attaches fine on JDK 25 here, confirmed while testing.
Test plan
mvn -pl rest-cxf-opentelemetry,rest-cxf-opentelemetry/rest-cxf-otel-common,rest-cxf-opentelemetry/rest-cxf-otel-random,rest-cxf-opentelemetry/rest-cxf-otel-even,rest-cxf-opentelemetry/rest-cxf-otel-odd -am package-Potel-agent, starteddocker-compose(minio, otel-collector, jaeger), pre-created theevenoddminio bucket, and ran all 3 services (random:8080, even:8081, odd:8082) with the javaagent attachedPOST /services/api/play/5onrandom→ 200, correct even/odd split result (exercises the full random → even/odd → register → minio round trip)POST /services/api/checkonevenandodddirectly → 200GET /services/api/generateonrandom→ 200Opentelemetry2 enabled, no deprecation warning, no exceptions🤖 Generated with Claude Code