none
Queue is not empty

    Question

  • It is regarding Queue service. I have a non empty queue and there are no messages to process. I don't know what happened to the messages. Azure storage explorer application which shows 0 messages. Can you tell me why this is happening.
    Thursday, June 25, 2015 9:02 AM

Answers

  • Hi,

    Thanks for posting here.

    x-ms-approximate-messages-count which is returned as part of Get Queue Metadata api response is an approximate number as the name suggests. If you have expired messages in the queue, you could get a non-zero number back from this response header until these expired messages get garbage collected internally within the storage service. Peek or list messages will not return any message in such scenario as the ones present are all expired. If you want this number to reflect what's left to process in the queue, you need to make sure messages do not expire in your queue.

    The messages may not be visible to you due to the following reason:

    "When a message is retrieved from the queue, the response includes the message and a pop receipt value, which is required to delete the message. The message is not automatically deleted from the queue, but after it has been retrieved, it is not visible to other clients for the time interval specified by the visibilitytimeout parameter.

    If multiple messages are retrieved, each message has an associated pop receipt. The maximum number of messages that may be retrieved at a time is 32.

    The client that retrieves the message is expected to delete the message after it has been processed, and before the time specified by the TimeNextVisible element of the response, which is calculated based on the value of the visibilitytimeout parameter. The value of visibilitytimeout is added to the time at which the message is retrieved to determine the value of TimeNextVisible."

    Regards.

    Thursday, June 25, 2015 9:56 AM
    Moderator