Using AMQP module for Node JS and RabbitMQ, is there any way to tell how many subscribers there are on a queue?
We have multiple queues on the default exchange for multiple regions. When one region is down, instead of routing messages to that queue, we'll instead route to the next-best AMQP queue (region) that is actively listening.
Is there any way to count the number of subscribers on a queue?
We have a heartbeat set up so the server should be able to track accurately.
Thanks!
I ended up figuring out this piece of gold:
var conn = amqp.createConnection({ url: process.env.AMQP, heartbeat: 60 });
conn.queue('queue-name').on('queueDeclareOk', function(args) {
console.log('Total Consumers: ' + args.consumerCount);
}
Works perfectly :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With