Retrieving number of unacknowledged messages in RabbitMQ queue from Java/ Spring

前端 未结 2 1739
离开以前
离开以前 2021-02-08 16:46

is there any way to return the number of messages that are unacknowledged?

I am using this code to get the number of messages in the queue:

DeclareOk dec         


        
2条回答
  •  别那么骄傲
    2021-02-08 17:08

    As you say in your update, if you enable the management plugin, you can query the rest api:

    Eg:

    `http://username:password@queue-server:15672/api/queues/%2f/queue_name.queue`
    

    This returns json with (among other things)

    • messages_unacknowledged
    • messages_ready

    It's good stuff if you have a safe route to the server.

提交回复
热议问题