[ 
https://issues.apache.org/jira/browse/CAMEL-14243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987707#comment-16987707
 ] 

Serkan commented on CAMEL-14243:
--------------------------------

Btw, Ive changed the way Im creating JmsComponent. Im not defining it as a 
Spring Bean, and Im using the jms protocol now.

I think I've found the reason why my JMS route was not traced well. 

In the OpenTracingTracer class there are only 2 events on which is listened: 

@Override
public boolean isEnabled(EventObject event) {
     return event instanceof ExchangeSendingEvent || event instanceof 
ExchangeSentEvent;
}

But when you have the following route:
from("jms:queue...")...

ExchangeCreatedEvent is fired, and the tracing for this endpoint is skipped. 
And this has to be the first event in the chain to check for an existing 
traceId.

And strangely, the OpenTracingRoutePolicy (in OpenTracingTracer class) which 
listens for onExchangeBegin(..) is also never called.

So I wonder how this has been tested and worked before, because only adding a 
new SpanDecorator is not solving the problem.

> Opentracing with JMS not working when JmsComponent is defined as a Spring bean
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-14243
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14243
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-opentracing
>    Affects Versions: 2.24.2
>            Reporter: Serkan
>            Priority: Minor
>             Fix For: 3.1.0
>
>
> see also:
> [https://github.com/opentracing/opentracing-java/issues/307#issuecomment-560329283]
>  
> I'm using the following libraries:
> -JDK 8
> -camel 2.24.2
> -camel-jms-2.24.2
> -camel-opentracing 2.24.2
> -jaeger-client-0.34.0
>  
> Issue:
> -Define JmsComponent as a Spring bean:
> @Bean(name = "core-jms")
>  public JmsComponent createJmsComponentBean(
>  @Qualifier(value = "core-jmsConnectionFactory") ConnectionFactory 
> connectionFactory) throws JMSException
> { JmsComponent jmsComponent = new JmsComponent(); JmsConfiguration 
> jmsConfiguration = new JmsConfiguration(connectionFactory); 
> jmsConfiguration.setJmsMessageType(JmsMessageType.Text); 
> jmsConfiguration.setUseMessageIDAsCorrelationID(true); 
> jmsComponent.setConfiguration(jmsConfiguration); return jmsComponent; }
> If you use this JmsComponent in your route (like: from("core-jms://...) then 
> the protocol name change from jms:// into core-jms:// and the current 
> registered SpanDecorators wont match with this one. What will result into 
> wrong tracing id's among the whole flow.
> Thus let's say we have the following situation:
> Route A -> Jms Queue -> Route B -> WS call.
> What I expect is that Route A and Route B have the same traceId, but what I 
> get is 2 traces:
> one for Route A -> Jms Queue, and another one from Jms Queue -> Route B.
>  
> See also the discussion in the link above for more info.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to