opentracing-contrib / java-spring-rabbitmq

OpenTracing RabbitMQ instrumentation
Apache License 2.0
18 stars 21 forks source link

Support for multiple RabbitTemplate beans in the ApplicationContext #12

Open sudr opened 5 years ago

sudr commented 5 years ago

Currently the Spring Boot auto configuration will blow up on applicaiton startup if there is more than one bean of type RabbitTemplate. It would seem useful to support a collection of RabbitTemplate beans instead for applications that have multiple RabbitTemplate beans.

https://github.com/opentracing-contrib/java-spring-rabbitmq/blob/904bd38465c790a362740ceb8cf4f7f532d35ada/opentracing-spring-rabbitmq-starter/src/main/java/io/opentracing/contrib/spring/rabbitmq/RabbitMqTracingAutoConfiguration.java#L43

ask4gilles commented 5 years ago

Do you want to submit a PR for the next release?

sudr commented 5 years ago

I've since disabled Spring Boot's RabbitMQ AutoConfiguration for other reasons and so don't have a pressing need for this. If I have time next week I can take a look into solving this.

wuyupengwoaini commented 5 years ago

Looking forward to this feature.

ask4gilles commented 5 years ago

I just did some tests with several rabbit templates defined and it works now. Feel free to reopen this if needed.

arseny-tl commented 4 years ago

@ask4gilles Hi, i have this trouble right now. In io.opentracing.contrib.spring.rabbitmq.RabbitMqTracingAutoConfiguration bean with name rabbitMqSendTracingAspect required a single bean of rabbitTemplate. Could you check this for now, please?

arseny-tl commented 4 years ago

Also, i got the idea how to fix this - simply use ((RabbitTemplate) pjp.getTarget()).getMessageConverter and so on in aspect.

arseny-tl commented 4 years ago

@ask4gilles i want to try my best in my pull-request with changes. Currently, i have some work done with aspect + unit test, but have no idea how to write IT test with multiple RabbitTemplate beans. Can you help me with that? In my mind, i should create configuration with some rabbitTemplate beans in it, and then try to publish/publishAndRecieve messages, using both rabbit templates, and assert that both of them trace message. How can i organize my work on it, using already existing test utils?

ask4gilles commented 4 years ago

@arseny-tl Thank you for raising this PR! I'll try to find some time this week to have a look at it. Perhaps @sudr could also double check?

zouyx commented 3 years ago

anything update?

folaraz commented 1 year ago

please any update on this? @ask4gilles. @sudr were you able to find a workaround? thanks

ask4gilles commented 1 year ago

@folaraz This project is not maintained anymore

folaraz commented 1 year ago

got it thanks @ask4gilles. is this due to the migration over to opentelemetry? if yes, please what spring boot dependencies would achieve this same result as this library? thanks