Adding messages to a queue
The CloudQueue
class in the Windows Azure Storage Client Library provides both synchronous and asynchronous methods to add a message to a queue. A message comprises up to 8192 bytes of data. By default, the Storage Client library Base64 encodes message content to ensure that the request payload containing the message is valid XML. This encoding adds overhead that reduces the actual maximum size of a message. The Windows Azure SDK v1.3 added an EncodeMessage
property to CloudQueue allowing a message, the content of which is already valid XML, to be sent without being Base64 encoded.
Each message added to a queue has a time-to-live property after which it is deleted automatically. The maximum, and default, time-to-live value is 7 days.
In this recipe, we will learn how to add messages to a queue.
How to do it...
We are going to create a queue and add some messages to it. We do this as follows:
Add a new class named
AddMessagesExample
to the project.Set the Target Framework...