Check RabbitMQ queue size from client

后端 未结 9 1107
终归单人心
终归单人心 2021-01-30 20:12

Does anyone know if there\'s a way to check the number of messages in a RabbitMQ queue from a client application?

I\'m using the .NET client library.

9条回答
  •  孤独总比滥情好
    2021-01-30 21:00

    I'm using version 3.3.1 of the .NET client library.

    I use the following, which is very similar to Ralph Willgoss's second suggestion, but you can supply the queue name as an argument.

    QueueDeclareOk result = channel.QueueDeclarePassive(queueName);
    uint count = result != null ? result.MessageCount : 0;
    

提交回复
热议问题