簡體   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