John Poth created CAMEL-21302:
---------------------------------

             Summary: camel-opentelemetry context leak with cxf async producer
                 Key: CAMEL-21302
                 URL: https://issues.apache.org/jira/browse/CAMEL-21302
             Project: Camel
          Issue Type: Bug
          Components: camel-opentelemetry
            Reporter: John Poth


There seems to be a Otel context leak when using a CXF producer in async mode. 
This causes different requests to have the same _traceId._ As a workaround, 
setting _synchronous=true_ on the CXF producer resolves the issue. Here's a 
reproducer:



{code:java}
@Override
protected RoutesBuilder createRouteBuilder() {
    return new RouteBuilder() {
        @Override
        public void configure() {
            from("direct:start").routeId("myRoute")
                    .to("direct:send")
                    .end();

            from("direct:send")
                    .log("message")
                    .to("cxfrs:http://localhost:"; + port1
                        + "/rest/helloservice/sayHello?synchronous=false"); // 
setting to 'true' resolves the issue

            restConfiguration()
                    .port(port1);

            rest("/rest/helloservice")
                    .post("/sayHello").routeId("rest-GET-say-hi")
                    .to("direct:sayHi");

            from("direct:sayHi")
                    .routeId("mock-GET-say-hi")
                    .log("example")
                    .to("mock:end");
}};
{code}
 

I've added the complete unit here: 
https://github.com/apache/camel/blob/7d83a62b8e442dc9ac6fd79b153192add940301e/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/AsyncCxfTest.java



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to