java-spring-rabbitmq icon indicating copy to clipboard operation
java-spring-rabbitmq copied to clipboard

RabbitMqSendTracingAspect does not interfere in RestTemplate.invoke

Open huehnerlady opened this issue 4 years ago • 5 comments

Hi,

we use the following snippet for publishing messages:

rabbitTemplate.invoke({ RabbitOperations operations ->
      operations.convertAndSend(<EXCHANGE>, null as String, payload, defaultPublishMessagePostProcessor)
      operations.waitForConfirmsOrDie(DEFAULT_WAIT_TIMEOUT_IN_MS)
      return true
    })

Unfortunately the class RabbitMqSendTracingAspect does just interfere with the sending options of the rest template, but seems not to work inside the invoke method. We need this snippet to ensure that the message we send actually arrived on rabbitMQ.

Is there any plans to enhance the Aspect to also be able to work with our snippet?

huehnerlady avatar Mar 12 '20 16:03 huehnerlady

Anybody? 😞

huehnerlady avatar Mar 25 '20 16:03 huehnerlady

Hi @huehnerlady , Sorry but I don't have the time to look at this for the moment. Feel free to submit a PR and I'll find the time to review it.

ask4gilles avatar Mar 26 '20 07:03 ask4gilles

@ask4gilles many thanks for your answer. Unfortunately I do not understand the Aspects well, but will see what I can do

huehnerlady avatar Mar 26 '20 07:03 huehnerlady

@huehnerlady alright, if you can come with something, I could find the time to help with that.

ask4gilles avatar Mar 26 '20 07:03 ask4gilles

It seems that AOP will not work in this case even if you intercept RabbitTemplate#convertAndSend. See method invoke: image So this is sort of an internal call, check https://stackoverflow.com/questions/13564627/spring-aop-not-working-for-method-call-inside-another-method

zysaaa avatar Oct 15 '21 00:10 zysaaa