Пример #1
0
        public static async Task ServiceBusTopicSender()
        {
            var keyvaultOperations = new KeyVaultOperations("someurl");

            var connectionString = await keyvaultOperations.GetSecretAsync("someSecretName");

            var topicName = await keyvaultOperations.GetSecretAsync("someSecretName");

            var someTopicSetting = TopicSettingsFactory.CreateDevelopmentSettings(connectionString, topicName);
            var messageSender    = new MessageSender(someTopicSetting);

            var message = MessageFactory.CreateMessage();
            await messageSender.SendMessageAsync(message);

            await messageSender.CloseAsync();
        }
Пример #2
0
        public static async Task KeyVault()
        {
            var keyvaultOperations = new KeyVaultOperations("someurl");

            var secret = await keyvaultOperations.GetSecretAsync("someSecretName");

            var certificate = await keyvaultOperations.GetCertificateAsync("someCertificateName");
        }
Пример #3
0
        public static async Task ServiceBusTopicSubscriptionListner()
        {
            var keyvaultOperations = new KeyVaultOperations("someurl");

            var connectionString = await keyvaultOperations.GetSecretAsync("someSecretName");

            var subscriptionName = await keyvaultOperations.GetSecretAsync("someSecretName");

            var subscriptionSettings = SubscriptionSettingsFactory.CreateSubsriptionSettings(connectionString, subscriptionName, ReceiveMode.PeekLock);

            var messageReceiver = new MessageReceiver(subscriptionSettings);

            messageReceiver.Start(message =>
            {
                var payload = Encoding.UTF8.GetString(message.Body);
            });

            await messageReceiver.StopAsync();
        }