|
1 | | -//---------------------------------------------------------------------------------- |
2 | | -// Microsoft Azure Storage Team |
3 | | -// |
4 | | -// Copyright (c) Microsoft Corporation. All rights reserved. |
5 | | -// |
6 | | -// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, |
7 | | -// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES |
8 | | -// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. |
9 | | -//---------------------------------------------------------------------------------- |
10 | | -// The example companies, organizations, products, domain names, |
11 | | -// e-mail addresses, logos, people, places, and events depicted |
12 | | -// herein are fictitious. No association with any real company, |
13 | | -// organization, product, domain name, email address, logo, person, |
14 | | -// places, or events is intended or should be inferred. |
15 | | -//---------------------------------------------------------------------------------- |
16 | | - |
17 | | -using System; |
18 | | - |
19 | | -namespace QueueStorage |
20 | | -{ |
21 | | - |
22 | | - /// <summary> |
23 | | - /// Azure Queue Service Sample - The Queue Service provides reliable messaging for workflow processing and for communication |
24 | | - /// between loosely coupled components of cloud services. This sample demonstrates how to perform common tasks including |
25 | | - /// inserting, peeking, getting and deleting queue messages, as well as creating and deleting queues. |
26 | | - /// |
27 | | - /// Note: This sample uses the .NET 4.5 asynchronous programming model to demonstrate how to call the Storage Service using the |
28 | | - /// storage client libraries asynchronous API's. When used in real applications this approach enables you to improve the |
29 | | - /// responsiveness of your application. Calls to the storage service are prefixed by the await keyword. |
30 | | - /// |
31 | | - /// Documentation References: |
32 | | - /// - What is a Storage Account - http://azure.microsoft.com/en-us/documentation/articles/storage-whatis-account/ |
33 | | - /// - Getting Started with Queues - http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/ |
34 | | - /// - Queue Service Concepts - http://msdn.microsoft.com/en-us/library/dd179353.aspx |
35 | | - /// - Queue Service REST API - http://msdn.microsoft.com/en-us/library/dd179363.aspx |
36 | | - /// - Queue Service C# API - http://go.microsoft.com/fwlink/?LinkID=398944 |
37 | | - /// - Storage Emulator - http://msdn.microsoft.com/en-us/library/azure/hh403989.aspx |
38 | | - /// - Asynchronous Programming with Async and Await - http://msdn.microsoft.com/en-us/library/hh191443.aspx |
39 | | - /// </summary> |
40 | | - public class Program |
41 | | - { |
42 | | - // ************************************************************************************************************************* |
43 | | - // Instructions: This sample can be run using either the Azure Storage Emulator that installs as part of this SDK - or by |
44 | | - // updating the App.Config file with your AccountName and Key. |
45 | | - // |
46 | | - // To run the sample using the Storage Emulator (default option) |
47 | | - // 1. Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it |
48 | | - // by typing "Azure Storage Emulator". Select it from the list of applications to start it. |
49 | | - // 2. Set breakpoints and run the project using F10. |
50 | | - // |
51 | | - // To run the sample using the Storage Service |
52 | | - // 1. Open the app.config file and comment out the connection string for the emulator (UseDevelopmentStorage=True) and |
53 | | - // uncomment the connection string for the storage service (AccountName=[]...) |
54 | | - // 2. Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in |
55 | | - // the App.Config file. See http://go.microsoft.com/fwlink/?LinkId=325277 for more information |
56 | | - // 3. Set breakpoints and run the project using F10. |
57 | | - // |
58 | | - // ************************************************************************************************************************* |
59 | | - public static void Main() |
60 | | - { |
61 | | - Console.WriteLine("Azure Storage Queue Sample\n"); |
62 | | - |
63 | | - // Create queue, insert message, peek message, read message, change contents of queued message, |
64 | | - // queue 20 messages, get queue length, read 20 messages, delete queue. |
65 | | - GettingStarted getStarted = new GettingStarted(); |
66 | | - getStarted.RunQueueStorageOperationsAsync().Wait(); |
67 | | - |
68 | | - // Get list of queues in storage account. |
69 | | - Advanced advMethods = new Advanced(); |
70 | | - advMethods.RunQueueStorageAdvancedOpsAsync().Wait(); |
71 | | - |
72 | | - Console.WriteLine("Press any key to exit."); |
73 | | - Console.Read(); |
74 | | - } |
75 | | - |
76 | | - |
77 | | - } |
78 | | -} |
| 1 | +//---------------------------------------------------------------------------------- |
| 2 | +// Microsoft Azure Storage Team |
| 3 | +// |
| 4 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 5 | +// |
| 6 | +// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, |
| 7 | +// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES |
| 8 | +// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | +//---------------------------------------------------------------------------------- |
| 10 | +// The example companies, organizations, products, domain names, |
| 11 | +// e-mail addresses, logos, people, places, and events depicted |
| 12 | +// herein are fictitious. No association with any real company, |
| 13 | +// organization, product, domain name, email address, logo, person, |
| 14 | +// places, or events is intended or should be inferred. |
| 15 | +//---------------------------------------------------------------------------------- |
| 16 | + |
| 17 | +using System; |
| 18 | + |
| 19 | +namespace QueueStorage |
| 20 | +{ |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// Azure Queue Service Sample - The Queue Service provides reliable messaging for workflow processing and for communication |
| 24 | + /// between loosely coupled components of cloud services. This sample demonstrates how to perform common tasks including |
| 25 | + /// inserting, peeking, getting and deleting queue messages, as well as creating and deleting queues. |
| 26 | + /// |
| 27 | + /// Note: This sample uses the .NET 4.5 asynchronous programming model to demonstrate how to call the Storage Service using the |
| 28 | + /// storage client libraries asynchronous API's. When used in real applications this approach enables you to improve the |
| 29 | + /// responsiveness of your application. Calls to the storage service are prefixed by the await keyword. |
| 30 | + /// |
| 31 | + /// Documentation References: |
| 32 | + /// - What is a Storage Account - http://azure.microsoft.com/en-us/documentation/articles/storage-whatis-account/ |
| 33 | + /// - Getting Started with Queues - http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/ |
| 34 | + /// - Queue Service Concepts - http://msdn.microsoft.com/en-us/library/dd179353.aspx |
| 35 | + /// - Queue Service REST API - http://msdn.microsoft.com/en-us/library/dd179363.aspx |
| 36 | + /// - Queue Service C# API - http://go.microsoft.com/fwlink/?LinkID=398944 |
| 37 | + /// - Storage Emulator - http://msdn.microsoft.com/en-us/library/azure/hh403989.aspx |
| 38 | + /// - Asynchronous Programming with Async and Await - http://msdn.microsoft.com/en-us/library/hh191443.aspx |
| 39 | + /// </summary> |
| 40 | + public class Program |
| 41 | + { |
| 42 | + // ************************************************************************************************************************* |
| 43 | + // Instructions: This sample can be run using either the Azure Storage Emulator that installs as part of this SDK - or by |
| 44 | + // updating the App.Config file with your AccountName and Key. |
| 45 | + // |
| 46 | + // To run the sample using the Storage Emulator (default option) |
| 47 | + // 1. Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it |
| 48 | + // by typing "Azure Storage Emulator". Select it from the list of applications to start it. |
| 49 | + // 2. Set breakpoints and run the project using F10. |
| 50 | + // |
| 51 | + // To run the sample using the Storage Service |
| 52 | + // 1. Open the app.config file and comment out the connection string for the emulator (UseDevelopmentStorage=True) and |
| 53 | + // uncomment the connection string for the storage service (AccountName=[]...) |
| 54 | + // 2. Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in |
| 55 | + // the App.Config file. See http://go.microsoft.com/fwlink/?LinkId=325277 for more information |
| 56 | + // 3. Set breakpoints and run the project using F10. |
| 57 | + // |
| 58 | + // ************************************************************************************************************************* |
| 59 | + public static void Main() |
| 60 | + { |
| 61 | + Console.WriteLine("Azure Storage Queue Sample\n"); |
| 62 | + |
| 63 | + // Create queue, insert message, peek message, read message, change contents of queued message, |
| 64 | + // queue 20 messages, get queue length, read 20 messages, delete queue. |
| 65 | + GettingStarted getStarted = new GettingStarted(); |
| 66 | + getStarted.RunQueueStorageOperationsAsync().Wait(); |
| 67 | + |
| 68 | + // Get list of queues in storage account. |
| 69 | + Advanced advMethods = new Advanced(); |
| 70 | + advMethods.RunQueueStorageAdvancedOpsAsync().Wait(); |
| 71 | + |
| 72 | + Console.WriteLine("Press any key to exit."); |
| 73 | + Console.Read(); |
| 74 | + } |
| 75 | + |
| 76 | + |
| 77 | + } |
| 78 | +} |
0 commit comments