有什么方法可以检查消息是否已发布?

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

我需要使用 Java 检查 RabbitMQ 队列中的消息。我已经完成 the standard Java API documentation of RabbitMQ but it seems that there is no standard way described there. I have also referred to this 但没有找到任何标准方法。

我试图通过此实现的目标可以概括为:

  1. 我的应用程序将向 fanout 交换发布消息。

  2. 现在我想获取我的应用程序发布的消息的内容,或者确认消息是否发布到正确的交换中。

如何使用 Java 完成此操作?

使用 publisher confirms,将消息本身添加到 CorrelationData 参数中,然后,当您通过 Ack 获得回调时,您可以访问消息。

the documentation