This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch cxf-sync in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/cxf-sync by this push: new 466fac6b1d2 CAMEL-21309: camel-cxf - Force using sync client when using tracing/opentelemetry as otherwise spans are not working correctly. 466fac6b1d2 is described below commit 466fac6b1d232ae418716e80b993dda0f1cb6da8 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Oct 3 08:47:59 2024 +0200 CAMEL-21309: camel-cxf - Force using sync client when using tracing/opentelemetry as otherwise spans are not working correctly. --- .../org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 11 +++++++++-- .../org/apache/camel/component/cxf/jaxws/CxfProducer.java | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java index 5f3f4bb1adf..253c00d9f9b 100644 --- a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java +++ b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java @@ -117,6 +117,7 @@ public class CxfRsProducer extends DefaultAsyncProducer { } catch (Exception e) { exchange.setException(e); } + callback.done(true); return true; } @@ -134,7 +135,6 @@ public class CxfRsProducer extends DefaultAsyncProducer { } return false; } catch (Exception exception) { - LOG.error("Error invoking request", exception); exchange.setException(exception); callback.done(true); return true; @@ -142,6 +142,8 @@ public class CxfRsProducer extends DefaultAsyncProducer { } protected void invokeAsyncHttpClient(Exchange exchange, final AsyncCallback callback) throws Exception { + LOG.trace("Process exchange: {} (asynchronously)", exchange); + Message inMessage = exchange.getIn(); JAXRSClientFactoryBean cfb = clientFactoryBeanCache.get(CxfRsEndpointUtils .getEffectiveAddress(exchange, ((CxfRsEndpoint) getEndpoint()).getAddress())); @@ -200,6 +202,8 @@ public class CxfRsProducer extends DefaultAsyncProducer { } protected void invokeAsyncProxyClient(Exchange exchange, final AsyncCallback callback) throws Exception { + LOG.trace("Process exchange: {} (asynchronously)", exchange); + Message inMessage = exchange.getIn(); Object[] varValues = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_VAR_VALUES, Object[].class); String methodName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class); @@ -275,7 +279,6 @@ public class CxfRsProducer extends DefaultAsyncProducer { } protected void setupClientMatrix(WebClient client, Exchange exchange) throws Exception { - org.apache.cxf.message.Message cxfMessage = (org.apache.cxf.message.Message) exchange.getIn().getHeader(CxfConstants.CAMEL_CXF_MESSAGE); if (cxfMessage != null) { @@ -306,6 +309,8 @@ public class CxfRsProducer extends DefaultAsyncProducer { } protected void invokeHttpClient(Exchange exchange) throws Exception { + LOG.trace("Process exchange: {} (synchronously)", exchange); + Message inMessage = exchange.getIn(); JAXRSClientFactoryBean cfb = clientFactoryBeanCache.get(CxfRsEndpointUtils .getEffectiveAddress(exchange, ((CxfRsEndpoint) getEndpoint()).getAddress())); @@ -453,6 +458,8 @@ public class CxfRsProducer extends DefaultAsyncProducer { } protected void invokeProxyClient(Exchange exchange) throws Exception { + LOG.trace("Process exchange: {} (synchronously)", exchange); + Message inMessage = exchange.getIn(); Object[] varValues = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_VAR_VALUES, Object[].class); String methodName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class); diff --git a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfProducer.java b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfProducer.java index 56416d955e7..48945056044 100644 --- a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfProducer.java +++ b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfProducer.java @@ -108,6 +108,7 @@ public class CxfProducer extends DefaultAsyncProducer { } catch (Exception e) { camelExchange.setException(e); } + callback.done(true); return true; }