コード例 #1
0
        /// <summary>
        /// Provision service bus queues
        /// </summary>
        /// <param name="serviceBusConnectionString">Service bus connection string</param>
        /// <returns>Provision task</returns>
        private static async Task ProvisionServiceBusQueues(string serviceBusConnectionString)
        {
            Console.WriteLine("Creating service bus queues...");
            foreach (QueueIdentifier queueIdentifier in Enum.GetValues(typeof(QueueIdentifier)))
            {
                if (!QueueDescriptorProvider.Queues.ContainsKey(queueIdentifier))
                {
                    Console.WriteLine("  " + queueIdentifier.ToString() + " - Descriptor not found");
                    continue;
                }

                QueueDescriptor queueDescriptor = QueueDescriptorProvider.Queues[queueIdentifier];
                ServiceBus      serviceBus      = new ServiceBus(serviceBusConnectionString);
                await serviceBus.CreateQueueAsync(queueDescriptor.QueueName);

                Console.WriteLine("  " + queueIdentifier.ToString() + " - Queue Provisioned");
            }
        }