Example #1
0
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder();

            builder.AddJsonFile("appsettings.json", true, true);
            StorageQueueSample.Run().GetAwaiter().GetResult();
        }
Example #2
0
        public static async Task Run()
        {
            var connectionString = new StorageQueueSample()._appOptions.ConnectionString;

            await CreateQueue();

            await BasicQueueOperation(connectionString);
            await UpdateQueueMessage(connectionString);
            await DequeueQueue(connectionString);

            Console.WriteLine("Press a key to exit.");
            Console.ReadLine();
        }
Example #3
0
        public static async Task <bool> CreateQueue()
        {
            string name             = "demotest-" + Guid.NewGuid().ToString();
            var    connectionString = new StorageQueueSample()._appOptions.ConnectionString;
            var    client           = GetQueueClient(connectionString);

            // Retrieve a reference to a queue.
            CloudQueue queue = client.GetQueueReference(name);

            try
            {
                // Create the queue if it doesn't already exist.
                await queue.CreateIfNotExistsAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            return(true);
        }