1

Related question:Get queue size from rabbitmq consumer's callback with PhpAmqpLib

In the above question the message count is obtained by queue_declare. However this message count only counts messages that are in the queue, but not the prefetched messages (which is exactly what the poster of that question is experiencing)

If I set the prefetch_count (in basic_qos) to 1 and send ack for every single message then the message count works perfectly, but if I set the prefetch_count to 10 and send ack for every 5 messages then the message count will be something like 100, 100, 100, 100, 100, 95, 95, 95, 95, 95, ... when each message is handled.

What I want is to get the number of prefetched messages as well and add them up so that I will have the correct message count, including prefetched not but processed messages, when each message is handled.

Is there a way to obtain this number of cached messages in php-amqplib?

cr001
  • 655
  • 4
  • 16
  • Glancing through [the API reference](https://www.rabbitmq.com/amqp-0-9-1-quickref.html) doesn't show anything relevant, so you might have to use [the HTTP API from the management plugin](https://www.rabbitmq.com/management.html#http-api). – IMSoP Dec 06 '21 at 19:08

0 Answers0