-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a902a6
commit 9432ec1
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/KeyVaultProvider.TestApp/KeyVaultProvider.TestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="KeyVaultProvider.TestApp.csproj.DotSettings" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ServiceBus.AttachmentPlugin" Version="[3.0.0-*, )" /> | ||
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="[3.*, )" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\KeyVaultProvider\KeyVaultProvider.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
2 changes: 2 additions & 0 deletions
2
src/KeyVaultProvider.TestApp/KeyVaultProvider.TestApp.csproj.DotSettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp71</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.ServiceBus; | ||
using Microsoft.Azure.ServiceBus.Core; | ||
using Microsoft.Azure.ServiceBus.Management; | ||
using ServiceBus.AttachmentPlugin; | ||
|
||
namespace KeyVaultProviderTestApp | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
var connectionString = Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"); | ||
var managementClient = new ManagementClient(connectionString); | ||
if (!await managementClient.QueueExistsAsync("attachments")) | ||
{ | ||
await managementClient.CreateQueueAsync("attachments"); | ||
} | ||
|
||
var queueClient = new QueueClient(connectionString, "attachments", ReceiveMode.ReceiveAndDelete); | ||
|
||
var configuration = new AzureStorageAttachmentConfiguration(new KeyVaultProvider("https://keyvaultplugin.vault.azure.net/secrets/storage-connection-string")); | ||
|
||
queueClient.RegisterAzureStorageAttachmentPlugin(configuration); | ||
await queueClient.SendAsync(new Message(Encoding.UTF8.GetBytes("hello"))); | ||
|
||
var messageReceiver = new MessageReceiver(connectionString, "attachments", ReceiveMode.ReceiveAndDelete); | ||
messageReceiver.RegisterAzureStorageAttachmentPlugin(configuration); | ||
|
||
var message = await messageReceiver.ReceiveAsync(TimeSpan.FromSeconds(3)); | ||
|
||
Console.WriteLine($"Received message with body: {Encoding.UTF8.GetString(message.Body)}"); | ||
|
||
Console.ReadLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters