Windows Azure Queues And Windows Azure Service Bus Queues

A few days ago I was working on Azure queues to pass a message from one role to another. While reading articles about queues, I came across two types of queues available in Windows Azure.

We will have a look at these topics here.

First, why do we require queues in Azure?

In my experience, I have used queues to perform some action or operation in one role depending on another role. Let me clarify that.

Suppose, I want to perform some action in the worker role like zipping a document depending on performing actions in the web role. So, then how do we do this?

In this case, we can use queues. From the worker role you can send messages and in the worker role that works as a background worker, you can fetch messages and do necessary tasks.

But, there two types of queues available; they are:

  1. Windows Azure Queues.
  2. Windows Azure Service Bus Queues.

When and which queue is to be used?

Windows Azure Queues

Windows Azure Queue Storage is a service for storing a large number of messages that can be accessed from anywhere using HTTP or HTTPS. A single message can be up to 64KB in size. So, a queue may contain millions of messages. It is basically a part of Windows Azure Storage and enabled with a REST based architecture.

Service Bus Queues

It is a part of the Windows Azure messaging infrastructure that supports queuing, publishing etc..

The Windows Azure Queues are suitable for:

  1. Windows Azure queues were introduced first. It is a dedicated storage mechanism built on top of the Windows Azure storage service for processing queues.
  2. When an application needs to store and send over 5GB worth of messages in a queue and where the lifetime of messages is shorter than 7 days.
  3. Whenever tracking of messages is required.
  4. Whenever server-side logs of all transactions is required.

The Service Bus Queues are suitable for:

  1. Service Bus Queues were introduced later with the latest release of Service Bus.
  2. It is built on the Brokered Messaging infrastructure.
  3. During full integration with WCF.
  4. Solution requires automatic duplicate detection.
  5. When the Time to live period exceeds more than 7 days.
  6. When messages are less than 256 KB.
  7. When Ordered delivery is required.
  8. Whenever the queue size will not go beyond 5 GB.

In my next article, we will discuss using queues in Windows Azure.