none
Queue is not empty, but no messages can be read

    Question

  • Hi,

    This is regarding the Queue Service on Azure.

    A weird issue - I have a non-empty queue (the number is a result of the get_queue_metadata method - currently lists 488 messages), however I when I call "peek_message" or "list_messages" - there are no messages to process. How can I tell what happened to these messages? Using the Azure Storage Explorer application shows 0 messages as well.

    This issue persists for days now.

    I am using the azure SDK for Ruby (version: 0.6.4).

    Thanks,

    Efrat.


    Tuesday, January 13, 2015 3:34 PM

Answers

  • 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. 
    Monday, January 19, 2015 5:50 PM

All replies

  • 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."


    Frank

    Tuesday, January 13, 2015 3:44 PM
  • Thank you for your answer. I am familiar with the visibilitytimeout property and it is set to be 4 hours for all my messages (without updates). However the messages are stuck for days now. 

    2 Questions:

    1. Is there a way to check for sure that indeed somehow the TimeNextVisible for a message in a queue is too far away? (some Admin console - maybe?)

    2. Is there a way to empty this queue (all invisible messages) and start from scratch?

    Thanks,

    Efrat.

    Tuesday, January 13, 2015 4:15 PM
  • 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. 
    Monday, January 19, 2015 5:50 PM