• Storage queues provide a consistent and reliable way to store messages that can be consumed by multiple workers.
  • Queue is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS.
  • A single queue message can be up to 64 kilobytes (KB) in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account.
  • A storage account can contain up to 200 terabytes (TB) of blob, queue, and table data.

Common use of Queue includes:

  • Creating a backlog of work to process asynchronously
  • Passing messages from an Azure web role to an Azure worker role.
  • URL format: You can address queues by using the following URL format:
  • The following URL addresses one of the queues in the diagram:
  • Queue: A queue contains a set of messages. All messages must be in a queue.
  • Message: A message, in any format, of up to 64KB.
  • The content in a queue message is stored as a string.
  • You can store complex objects in a queue by serializing them as a string.
  • Common Queue Message Actions:

  • Add Messages
  • Messages can be added to the queue

  • Get Message or Messages
  • Retrieves the next message or messages from the queue and they will be invisible to other clients for a specified timeout period.

  • Peek Message or Messages
  • Retrieves the next message or messages from the queue while keeping the message or messages visible to other clients

  •  Update Message
  • Updates the content or visibility timeout of a specified message

  •  Delete Message
  • After a message is processed, you can delete the message from the queue so that it won’t be processed again.

    Timeout and Idempotent Processing:

  • Messages should be designed such that they can be processed multiple times without causing side effects.
  • This occurs because a message might become visible to other queue clients if the visibility timeout elapses and the message that was retrieved is not deleted.
  • Common scenarios where this might occur include worker role failure or transient service errors.

    Change the contents of a queued message:

  • You can change the contents of a message in-place in the queue. If the message represents a work task, you could use this feature to update the status of the work task.
  • The following code updates the queue message with new contents, and sets the visibility timeout to extend another 60 seconds. This saves the state of work associated with the message, and gives the client another minute to continue working on the message.
  • You could use this technique to track multi-step workflows on queue messages, without having to start over from the beginning if a processing step fails due to hardware or software failure. Typically, you would keep a retry count as well, and if the message is retried more than ntimes, you would delete it. This protects against a message that triggers an application error each time it is processed.