繁体   English   中英

RabbitMQ中的消费者数量(包括交易所)

[英]Count of consumers in RabbitMQ (with exchange)

如果我在RabbitMQ中不使用交换功能,则可以获得以下用户数:

channel.QueueDeclare(queue: "Sellers",
                     durable: false,
                     exclusive: false,
                     autoDelete: false,
                     arguments: null);

int sellersCount = channel.ConsumerCount("Sellers");

如何通过交易所检测消费者人数:

channel.ExchangeDeclare(exchange: "Shop",
                        type: "direct");

channel.BasicPublish(exchange: "Shop",
                     routingKey: "Sellers",
                     basicProperties: null,
                     body: body1);

channel.BasicPublish(exchange: "Shop",
                     routingKey: "Clients",
                     basicProperties: null,
                     body: body2);

int sellersCount = ???
int clientsCount = ???

为了详细阐述Evk评论 ,这里是RabbitMQ管理HTTP API文档 尝试GET /api/exchanges/vhost/name/bindings/source

以给定交换为源的所有绑定的列表。

请注意,关于此解决方案,还有几个 先前的答案可以解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM