OpenTracing JMS Commons


Лицензия

Лицензия

Группа

Группа

io.opentracing.contrib
Идентификатор

Идентификатор

opentracing-jms-common
Последняя версия

Последняя версия

0.1.11
Дата

Дата

Тип

Тип

jar
Описание

Описание

OpenTracing JMS Commons
OpenTracing JMS Commons

Скачать opentracing-jms-common

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-common/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-common</artifactId>
    <version>0.1.11</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-common/
implementation 'io.opentracing.contrib:opentracing-jms-common:0.1.11'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-common/
implementation ("io.opentracing.contrib:opentracing-jms-common:0.1.11")
'io.opentracing.contrib:opentracing-jms-common:jar:0.1.11'
<dependency org="io.opentracing.contrib" name="opentracing-jms-common" rev="0.1.11">
  <artifact name="opentracing-jms-common" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-jms-common', version='0.1.11')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-jms-common" % "0.1.11"
[io.opentracing.contrib/opentracing-jms-common "0.1.11"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
io.opentracing : opentracing-api jar 0.33.0

provided (2)

Идентификатор библиотеки Тип Версия
javax.jms : jms-api jar 1.1-rev-1
org.slf4j : slf4j-api jar 1.7.25

test (4)

Идентификатор библиотеки Тип Версия
org.apache.activemq : activemq-broker jar 5.15.11
org.awaitility : awaitility jar 3.1.6
junit : junit jar 4.12
io.opentracing : opentracing-mock jar 0.33.0

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status Released Version Apache-2.0 license

OpenTracing JMS Instrumentation

OpenTracing instrumentation for JMS.

Installation

JMS 1

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-1</artifactId>
    <version>VERSION</version>
</dependency>

JMS 2

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-2</artifactId>
    <version>VERSION</version>
</dependency>

Spring JMS

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-spring</artifactId>
    <version>VERSION</version>
</dependency>

You most likely need to exclude spring-jms and spring-context dependencies and add own (to avoid jar hell):

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-spring</artifactId>
    <version>VERSION</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </exclusion>
        <exclusion>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jms</artifactId>
    <version>required version</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>required version</version>
</dependency>

Usage

// Instantiate tracer
Tracer tracer = ...

JMS API

// decorate JMS MessageProducer with TracingMessageProducer
TracingMessageProducer producer = new TracingMessageProducer(messageProducer, tracer);

// decorate JMS JMSProducer with TracingJMSProducer need Session
Session session = ...
TracingJMSProducer producer = new TracingJMSProducer(jmsProducer, session, tracer);
// or with JMSContext
JMSContext jmsContext = ...
TracingJMSProducer producer = new TracingJMSProducer(jmsProducer, jmsContext, tracer);

// decorate JMS MessageConsumer with TracingMessageConsumer
TracingMessageConsumer consumer = new TracingMessageConsumer(messageConsumer, tracer);

// decorate JMS MessageListener if used with TracingMessageListener
TracingMessageListener listener = new TracingMessageListener(messageListener, tracer);
consumer.setMessageListener(listener);

// send message
Message message = ...
producer.send(message);

// receive message
Message message = consumer.receive();

Spring JMS

// create TracingJmsTemplate which extends Spring JmsTemplate
JmsTemplate jmsTemplate = new TracingJmsTemplate(connectionFactory, tracer); 

// send and receive messages as usual
jmsTemplate.send(...)
jmsTemplate.convertAndSend(...);
jmsTemplate.receive(...)
jmsTemplate.receiveAndConvert(...);
...

If @JmsListener is used then it is required to import TracingJmsConfiguration e.g.

@Configuration 
@Import(TracingJmsConfiguration.class)
@EnableJms
public class JmsConfiguration {
 ...
}

Java 9+

Modules opentracing-jms-1 and opentracing-jms-2 have next Automatic-Module-Name accordingly:

  • io.opentracing.contrib.jms1
  • io.opentracing.contrib.jms2

OpenTracing Conventions

Message properties

When a message exchange between a producer and consumer is traced using an OpenTracing compliant tracer, the trace context and any defined baggage items will be carried in the JMS message properties.

OpenTracing does not place any restrictions on the names used for the trace context and baggage item properties. However the JMS API does not permit the hyphen/dash - character to be used. Therefore, it is necessary to encode the trace context and baggage item names.

The steps used to encode the key names are:

  • replace any - character with __dash__

When the message is consumed, the steps are reversed to decode the original key names.

Any libraries that instrument the JMS API should conform to this convention to enable tracing interoperability.

License

Apache 2.0 License.

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Версии библиотеки

Версия
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1