Beispiel #1
0
        private static async Task ProcessMessageAsync(Message message, CancellationToken token)
        {
            string       jsonString = Encoding.UTF8.GetString(message.Body);
            CabinetOrder order      = JsonSerializer.Deserialize <CabinetOrder>(jsonString);

            Console.WriteLine($"Processing order of cabinet. Material Type: {order.MaterialType}, " +
                              $"Door Specification: {order.DoorSepcification}, Number Of Doors: {order.NumberOfDoors}" +
                              $"Drawer Specification: {order.DrawerSepcification}, Number Of Drawer: {order.NumberOfDrawers}");

            await queueClient.CompleteAsync(message.SystemProperties.LockToken);
        }
        static async Task Main(string[] args)
        {
            CabinetOrder order = new CabinetOrder
            {
                MaterialType        = "Birch Wood",
                DoorSepcification   = "Width - 12 in, Height - 20 in",
                NumberOfDoors       = 1,
                DrawerSepcification = "Width - 12 in, Depth - 14 in, Height - 4 in",
                NumberOfDrawers     = 2
            };

            await QueueService.SendMessageAsync(order);

            Console.WriteLine("Your message was successfully queued.");
        }