spring-projects / spring-amqp

Spring AMQP - support for Spring programming model with AMQP, especially but not limited to RabbitMQ
https://spring.io/projects/spring-amqp
Apache License 2.0
807 stars 620 forks source link

Add exchange/routingKey to RabbitMessageSenderContext #2816

Closed ngocnhan-tran1996 closed 1 week ago

ngocnhan-tran1996 commented 2 weeks ago

I see https://github.com/spring-projects/spring-amqp/issues/2814 and I think RabbitMessageSenderContext.java should have field exchange and routingKey.

But I think it's better if we use MessageProperties#setReceivedExchange and MessageProperties#setReceivedRoutingKey instead.

artembilan commented 2 weeks ago

The setReceivedExchange and setReceivedRoutingKey are for consumer side. Since there is no options in the org.springframework.amqp.core.Message fro destination properties, we don't have have unless provide them separately.

ngocnhan-tran1996 commented 2 weeks ago

This one is going to be follow up as a fix for the https://github.com/spring-projects/spring-amqp/issues/2814

vmeunier commented 1 week ago

@artembilan
I don't think my issue is still worth anything now since the tags were added here. I was actually trying to change this now and ended up checking at the code "it's already done ?! Did I smoke anything ?"

ngocnhan-tran1996 commented 1 week ago

@vmeunier

I follow your issue and added field exchange/routingkey. I think it will be easier for you to implement metrics/traces, and IMO it's not done yet.

vmeunier commented 1 week ago

@ngocnhan-tran1996 ok you're right, I don't know why you needed to add those informations, it confused me since I knew I had that stuff to change :)

artembilan commented 1 week ago

I believe the original issue talks about adding something like:

                    .and("messaging.destination.name", context.getExchange())
                    .and("messaging.rabbitmq.destination.routing_key", context.getRoutingKey());

into out-of-the-box convention. That one is not done yet, so keeping it opened until respective contribution. Thanks