Skip to content
Docs Try Aspire

AspireWebPubSubExtensions Methods

Class Methods 3 members
Provides extension methods for registering WebPubSub.WebPubSubServiceClient as a singleton in the services provided by the Hosting.IHostApplicationBuilder.
AddAzureWebPubSubServiceClient(IHostApplicationBuilder, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) Section titled AddAzureWebPubSubServiceClient(IHostApplicationBuilder, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) extension
Registers WebPubSub.WebPubSubServiceClient as a singleton in the services provided by the builder.
public static class AspireWebPubSubExtensions
{
public static void AddAzureWebPubSubServiceClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<AzureMessagingWebPubSubSettings>? configureSettings = null,
Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>? configureClientBuilder = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<AzureMessagingWebPubSubSettings> optional An optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.
configureClientBuilder Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>> optional An optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.
InvalidOperationException Thrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.
Reads the configuration from "Aspire.Azure.Messaging.WebPubSub" section.
AddKeyedAzureWebPubSubServiceClient(IHostApplicationBuilder, string, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) Section titled AddKeyedAzureWebPubSubServiceClient(IHostApplicationBuilder, string, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) extension
Registers WebPubSub.WebPubSubServiceClient as a singleton for given connectionName and serviceKey in the services provided by the builder.
public static class AspireWebPubSubExtensions
{
public static void AddKeyedAzureWebPubSubServiceClient(
this IHostApplicationBuilder builder,
string connectionName,
string serviceKey,
Action<AzureMessagingWebPubSubSettings>? configureSettings = null,
Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>? configureClientBuilder = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string The name of the component to retrieve the connection string from the ConnectionStrings configuration section.
serviceKey string The name of the component, which is used as the ServiceDescriptor.ServiceKey of the service, as well as the hub name is hub name is not set in the settings
configureSettings Action<AzureMessagingWebPubSubSettings> optional An optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.
configureClientBuilder Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>> optional An optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.
InvalidOperationException Thrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.
Reads the configuration from "Aspire.Azure.Messaging.WebPubSub:{name}" section.
AddKeyedAzureWebPubSubServiceClient(IHostApplicationBuilder, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) Section titled AddKeyedAzureWebPubSubServiceClient(IHostApplicationBuilder, string, Action<AzureMessagingWebPubSubSettings>, Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>) extension
Registers WebPubSub.WebPubSubServiceClient as a singleton for given connectionName in the services provided by the builder. This overload does not require a service key and uses the connection name as the service key to support scenarios where multiple Hubs are referenced in the same application.
public static class AspireWebPubSubExtensions
{
public static void AddKeyedAzureWebPubSubServiceClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<AzureMessagingWebPubSubSettings>? configureSettings = null,
Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>? configureClientBuilder = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string The name of the component to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<AzureMessagingWebPubSubSettings> optional An optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.
configureClientBuilder Action<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>> optional An optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.
InvalidOperationException Thrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.
Reads the configuration from "Aspire.Azure.Messaging.WebPubSub:{name}" section.