如果我不在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 = ???
答案 0 :(得分:0)
详细说明Evk' comment,RabbitMQ Management HTTP API documentation。试试GET /api/exchanges/vhost/name/bindings/source
:
给定交换所源的所有绑定的列表。