Storage Queue Client reports 0 messages regardless of message state, visibily or expiry date

stevemrf 96 Reputation points
2021-04-13T04:20:04.453+00:00

Hi Folks,

This queue has been working fine until today. I have fresh messages in a storage queue (I just added them) and when I call

QueueProperties properties = await theQueue.GetPropertiesAsync();

the approx count is 0.

I saw this queue-is-not-empty and this queue-shows-false-count

From a few years ago but none of the possible reasons mentioned seem to apply in my case. Message are new and unread. It doesn't appear to matter how many are there. The queue exists and looks like its being read, no errors anywhere as far as I can see.

This is my code to get & delete a message

QueueClient client = new QueueClient(connection, queue);

if (await client.ExistsAsync())
            {
                QueueProperties properties = await client.GetPropertiesAsync();

                if (properties.ApproximateMessagesCount > 0)
                {
                    QueueMessage[] qmsg = await client.ReceiveMessagesAsync(1);
                    string msg = qmsg[0].MessageText;
                    await client.DeleteMessageAsync(qmsg[0].MessageId, qmsg[0].PopReceipt);
                    return msg;
                }
            }

Sod's law this has happened at the end of a piece of development that is vital in a user registration story. I can't proceed without resolving this so any suggestions welcome and greatly appreciated.

Thanks in advance

Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
109 questions
0 comments No comments
{count} votes

Accepted answer
  1. stevemrf 96 Reputation points
    2021-04-13T04:33:19.677+00:00

    Of course it helps if you're pointing at the right storage account.

    Please ignore my question.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.