Azure Storage Queue Overview

Azure Queue Storage is a service that stores large numbers of messages that can be accessed from anywhere in the world using HTTP or HTTPS. A single queue can hold millions of messages. A message can be up to 64 KB in size, and can contain any kind of data.

What is Queue Storage?

Queue storage is a general-purpose queueing service. It's ideal for decoupling applications and components. For example, you can use Queue storage to asynchronously process tasks that are triggered by an HTTP request. When a client needs to perform a time-consuming operation, it can add a message to a queue, and the worker process can dequeue and process the message at its own pace.

Key Concepts

When to Use Queue Storage

Queue storage is well-suited for several common scenarios:

Features and Benefits

Working with Queue Storage

You can interact with Azure Queue Storage using various tools and SDKs:

Tip

For scenarios requiring more advanced features like message ordering guarantees, transactions, or complex routing, consider using Azure Service Bus queues.

Example: Adding a Message

Here's a conceptual example of adding a message to a queue using a hypothetical SDK:


// Assuming you have a queue client initialized
var queueClient = new QueueClient("YOUR_CONNECTION_STRING", "my-message-queue");

// Send a message
Response response = await queueClient.SendMessageAsync("Hello, Azure Queues!");

Console.WriteLine($"Message sent: {response.Value.MessageId}");
            

Example: Dequeueing a Message


# Assuming you have a queue client initialized
from azure.core.credentials import AzureKeyCredential
from azure.storage.queue import QueueClient

credential = AzureKeyCredential("YOUR_KEY")
queue_url = "YOUR_QUEUE_URL"
queue_client = QueueClient(queue_url, credential=credential)

# Receive and delete a message
messages = queue_client.receive_messages()
for message in messages:
    print(f"Processing message: {message.message_text}")
    queue_client.delete_message(message.message_id, message.pop_receipt)
print("All messages processed.")
            

Important Note

When dequeueing, always use the pop_receipt to delete the message. This ensures that the message is only deleted after successful processing.

Limitations