Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Azure Queue Streaming IConfiguration provider #9320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<!-- System packages -->
<PackageVersion Include="Aspire.Azure.Storage.Queues" Version="9.0.0" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="8.0.1" />
<PackageVersion Include="System.IO.Hashing" Version="8.0.0" NoWarn="NU5104" />
<PackageVersion Include="System.IO.Pipelines" Version="8.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,22 @@ private static Action<OptionsBuilder<AzureQueueOptions>> GetQueueOptionBuilder(I

if (!string.IsNullOrEmpty(connectionString))
{
options.QueueServiceClient = Uri.TryCreate(connectionString, UriKind.Absolute, out var uri)
? new QueueServiceClient(uri)
: new QueueServiceClient(connectionString);
if (Uri.TryCreate(connectionString, UriKind.Absolute, out var uri))
{
if (!string.IsNullOrEmpty(uri.Query))
{
// SAS URI
options.QueueServiceClient = new QueueServiceClient(uri);
}
else
{
options.QueueServiceClient = new QueueServiceClient(uri, credential: new Azure.Identity.DefaultAzureCredential());
}
}
else
{
options.QueueServiceClient = new QueueServiceClient(connectionString);
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ItemGroup>
<ProjectReference Include="$(SourceRoot)src\Orleans.Streaming\Orleans.Streaming.csproj" />
<PackageReference Include="Azure.Core" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Storage.Blobs" />
<PackageReference Include="Azure.Storage.Queues" />
<PackageReference Include="Azure.Data.Tables" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Orleans.Hosting
{
/// <summary>
/// Extension methods for confiiguring streaming on silos.
/// Extension methods for configuring streaming on silos.
/// </summary>
public static class SiloBuilderStreamingExtensions
{
Expand Down
32 changes: 22 additions & 10 deletions src/Orleans.TestingHost/InProcTestCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,19 @@ public async Task InitializeClientAsync()
DisableDefaults = true,
});

foreach (var hostDelegate in Options.ClientHostConfigurationDelegates)
{
hostDelegate(hostBuilder);
}

hostBuilder.UseOrleansClient(clientBuilder =>
{
clientBuilder.Configure<ClusterOptions>(o =>
{
o.ClusterId = Options.ClusterId;
o.ServiceId = Options.ServiceId;
});

if (Options.UseTestClusterMembership)
{
clientBuilder.Services.AddSingleton<IGatewayListProvider>(_membershipTable);
Expand All @@ -509,11 +520,6 @@ public async Task InitializeClientAsync()

TryConfigureFileLogging(Options, hostBuilder.Services, "TestClusterClient");

foreach (var hostDelegate in Options.ClientHostConfigurationDelegates)
{
hostDelegate(hostBuilder);
}

ClientHost = hostBuilder.Build();
await ClientHost.StartAsync();
}
Expand Down Expand Up @@ -557,8 +563,19 @@ public async Task<InProcessSiloHandle> CreateSiloAsync(InProcessTestSiloSpecific
services.Configure<SiloMessagingOptions>(op => op.ResponseTimeout = TimeSpan.FromMilliseconds(1000000));
}

foreach (var hostDelegate in Options.SiloHostConfigurationDelegates)
{
hostDelegate(siloOptions, appBuilder);
}

appBuilder.UseOrleans(siloBuilder =>
{
siloBuilder.Configure<ClusterOptions>(o =>
{
o.ClusterId = Options.ClusterId;
o.ServiceId = Options.ServiceId;
});

siloBuilder.Configure<SiloOptions>(o =>
{
o.SiloName = siloOptions.SiloName;
Expand Down Expand Up @@ -590,11 +607,6 @@ public async Task<InProcessSiloHandle> CreateSiloAsync(InProcessTestSiloSpecific
}
});

foreach (var hostDelegate in Options.SiloHostConfigurationDelegates)
{
hostDelegate(siloOptions, appBuilder);
}

var host = appBuilder.Build();
InitializeTestHooksSystemTarget(host);
await host.StartAsync();
Expand Down
Loading
Loading