committed by
GitHub
parent
10c67d64e5
commit
1bcccbae6e
@@ -64,6 +64,10 @@ public class SleuthKafkaAspect {
|
||||
private void anyProducerFactory() {
|
||||
} // NOSONAR
|
||||
|
||||
@Pointcut("execution(public * org.springframework.kafka.core.ProducerFactory.createNonTransactionalProducer(..))")
|
||||
private void anyNonTransactionalProducerFactory() {
|
||||
} // NOSONAR
|
||||
|
||||
@Pointcut("execution(public * org.springframework.kafka.core.ConsumerFactory.createConsumer(..))")
|
||||
private void anyConsumerFactory() {
|
||||
} // NOSONAR
|
||||
@@ -76,7 +80,7 @@ public class SleuthKafkaAspect {
|
||||
private void anyCreateContainer() {
|
||||
} // NOSONAR
|
||||
|
||||
@Around("anyProducerFactory()")
|
||||
@Around("anyProducerFactory() || anyNonTransactionalProducerFactory()")
|
||||
public Object wrapProducerFactory(ProceedingJoinPoint pjp) throws Throwable {
|
||||
Producer producer = (Producer) pjp.proceed();
|
||||
return this.kafkaTracing.producer(producer);
|
||||
|
||||
@@ -96,6 +96,10 @@ public class BraveMessagingAutoConfigurationTests {
|
||||
public void should_wrap_kafka() {
|
||||
this.producerFactory.createProducer();
|
||||
then(this.mySleuthKafkaAspect.producerWrapped).isTrue();
|
||||
this.mySleuthKafkaAspect.producerWrapped = false;
|
||||
|
||||
this.producerFactory.createNonTransactionalProducer();
|
||||
then(this.mySleuthKafkaAspect.producerWrapped).isTrue();
|
||||
|
||||
this.consumerFactory.createConsumer();
|
||||
then(this.mySleuthKafkaAspect.consumerWrapped).isTrue();
|
||||
|
||||
Reference in New Issue
Block a user