private static void PrepareNextOrder(string connectionString) { var orderPizzaQueue = new OrderPizzaQueue(connectionString); var messages = orderPizzaQueue.GetMessagesAsync(1, TimeSpan.FromSeconds(10)).GetAwaiter().GetResult(); if (messages.Any()) { foreach (var message in messages) { var orderPizzaMessage = JsonConvert.DeserializeObject <OrderPizzaMessage>(message.AsString); Console.WriteLine($"Preparing order: {orderPizzaMessage.OrderId}"); // Preparing Task.Delay(TimeSpan.FromSeconds(10)); Console.WriteLine($"Pizza {orderPizzaMessage.OrderId} is ready for pick up!"); orderPizzaQueue.DeleteMessageAsync(message).GetAwaiter().GetResult(); } } }