Book Image

Microsoft Azure Development Cookbook Second Edition

Book Image

Microsoft Azure Development Cookbook Second Edition

Overview of this book

Table of Contents (15 chapters)
Microsoft Azure Development Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Adding messages to a Storage queue


The CloudQueue class in the Azure Storage library provides both synchronous and asynchronous methods to add a message to a queue. A message comprises up to 64 KB bytes of data (48 KB if encoded in Base64). By default, the Storage 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.

Tip

A message for a queue should not be intended to transport a big payload, since the purpose of a queue is just messaging and not storing. If required, a user can store the payload in a blob and use a queue message to point to that, letting the receiver fetch the message along with the blob from its remote location.

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'll learn how to add messages to a queue.

Getting ready

This...