-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdispatch_Program.cs
68 lines (54 loc) · 2.43 KB
/
dispatch_Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#### Check to see if Ian can edit this hahahah ###
using Azure;
using Azure.Storage.Queues;
using Azure.Storage.Queues.Models;
using System;
using System.Threading.Tasks;
namespace QueuesQuickstartV12
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Azure Queue Storage client library v12 - .NET quickstart sample\n");
// another comment, testing github
// Changed this andded a line.
//Retrieve the connection string for use with the application. The storage
// connection string is stored in an environment variable called
// AZURE_STORAGE_CONNECTION_STRING on the machine running the application.
// If the environment variable is created after the application is launched
// in a console or with Visual Studio, the shell or application needs to be
// closed and reloaded to take the environment variable into account.
string connectionString = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING");
//get number of people and create queue for each
Console.WriteLine("How many people in this shift?");
int shifters=System.Console.ReadLine();
Console.WriteLine($"Ok creating setup for {shifters} staff.");
// Create a unique name for the queue
string queueName = "dispatch-rd-quickstartqueues-" + Guid.NewGuid().ToString();
string queueName = "dispatch-rd-quickstartqueues-" + Guid.NewGuid().ToString();
string queueName = "dispatch-rd-quickstartqueues-" + Guid.NewGuid().ToString();
Console.WriteLine($"Creating queue: {queueName}");
// Instantiate a QueueClient which will be
// used to create and manipulate the queue
QueueClient queueClient = new QueueClient(connectionString, queueName);
// Create the queue
await queueClient.CreateAsync();
Console.WriteLine("\nAdding messages to the queue...");
// Send several messages to the queue
await queueClient.SendMessageAsync("First message");
await queueClient.SendMessageAsync("Second message");
// Save the receipt so we can update this message later
SendReceipt receipt = await queueClient.SendMessageAsync("Third message");
Console.WriteLine("\nPeek at the messages in the queue...");
// Peek at messages in the queue
PeekedMessage[] peekedMessages = await queueClient.PeekMessagesAsync(maxMessages: 10);
foreach (PeekedMessage peekedMessage in peekedMessages)
{
// Display the message
Console.WriteLine($"Message: {peekedMessage.MessageText}");
}
}
}
}