Search code examples
javarabbitmqspring-amqpspring-rabbit

Is there any way i can check that a messags has been published?


I need to check for messages inside a RabbitMQ queue using Java. I have gone through the standard Java API documentation of RabbitMQ but it seems that there is no standard way described there. I have also referred to this but failed to find any standard way.

What I am trying to achieve by this can be summarised as:

  1. My application will publish a message into a fanout exchange.

  2. Now here I want to get the contents of the message that has been published by my application or a confirmation whether the message is published or not into the correct exchange.

How can this be done using Java?


Solution

  • Use publisher confirms, add the message itself to the CorrelationData argument then, when you get a callback with the Ack, you can access the message.

    See the documentation.