Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21302

camel-opentelemetry context leak with direct async producer

    XMLWordPrintableJSON

Details

    • Needs James Gosling

    Description

      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:

      @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");
      }};
      

       

      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

      Attachments

        Issue Links

          Activity

            People

              ffang Freeman Yue Fang
              jpoth John Poth
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: