How to get the right number of messages remaining in a queue?

14 views
Skip to first unread message

lyuq...@gmail.com

unread,
Apr 6, 2019, 8:24:05 PM4/6/19
to simpleamqpclient-users
Hello,

I want to use get the number of messages in a queue using DeclareQueueWithCounts, but I cannot get the right number of messages. 

The problem is as follows:

Scenario:
I have a queue named "queue1", I bind the queue with two routing keys "queue1" and "queue".
I publish several messages to the queue using the routing key "queue".

Problem:
When I using DeclareQueueWithCounts("queue1", message_count, consumer_count) I always get the message_count as 0.
However, when I using subscribe, there are some messages. 

I see the code on the website https://github.com/alanxz/SimpleAmqpClient/blob/6323892d3e8701489fb945f45aa877a7e2a0ce31/testing/test_queue.cpp, it seems that the routing key should be the same as the queue_id when using the DeclareQueueWithCounts. 
Is there any way to get the right number of messages in a queue with multiple routing keys?

Thank you.

Reply all
Reply to author
Forward
0 new messages