SALES: 1-800-867-1380

OnDemandTransferInfo.FromQueueMessage Method

Updated: November 15, 2013

Creates an OnDemandTransferInfo object from queue messages sent by a diagnostic monitor when an on-demand transfer completes.

Namespace: Microsoft.WindowsAzure.Diagnostics.Management
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

public static OnDemandTransferInfo FromQueueMessage (
	string queueMessage
)

Parameters

queueMessage

The queue message text.

Return Value

Returns OnDemandTransferInfo.

The FromQueueMessage method creates an OnDemandTransferInfo object from the queue notification message sent by a diagnostic monitor when an on-demand transfer completes. Using this method does not remove the message from the queue, it must be removed manually.

Example

The following code snippet reads the queue where on-demand transfer information is stored, creates an OnDemandTransferInfo object using the FromQueueMessage method, and outputs the contents to the console.

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in
// the Windows Azure Management Portal (http://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

// Create a CloudQueueClient and get the queue where notifications are stored.
CloudQueueClient cloudQueueClient = storageAccount.CreateCloudQueueClient();
CloudQueue notificationQueue = cloudQueueClient.GetQueueReference("wad-on-demand-transfers");

// Stores the resulting on-demand transfer information.
OnDemandTransferInfo transferInfo;

// If the on-demand transfer queue exists, then process the queue message.
if (null != notificationQueue.GetMessage())
{
   CloudQueueMessage notificationMessage = notificationQueue.GetMessage();

   // Create a new OnDemandTransferInfo object from the notification message.
   transferInfo = OnDemandTransferInfo.FromQueueMessage(notificationMessage.AsString);

   // Write the values of the OnDemandTransferInfo to the console.
   Console.WriteLine("DeploymentId = " + transferInfo.DeploymentId);
   Console.WriteLine("NotificationQueueName = " + transferInfo.NotificationQueueName);
   Console.WriteLine("RequestId = " + transferInfo.RequestId);
   Console.WriteLine("RoleInstanceId = " + transferInfo.RoleInstanceId);
   Console.WriteLine("RoleName = " + transferInfo.RoleName);
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft