AspireWebPubSubExtensions Methods
ClassMethods3 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) { // ... }}Parameters
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.configureSettingsAction<AzureMessagingWebPubSubSettings>optionalAn optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.configureClientBuilderAction<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.Exceptions
InvalidOperationExceptionThrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.Remarks
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) { // ... }}Parameters
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.connectionNamestringThe name of the component to retrieve the connection string from the ConnectionStrings configuration section.serviceKeystringThe 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 settingsconfigureSettingsAction<AzureMessagingWebPubSubSettings>optionalAn optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.configureClientBuilderAction<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.Exceptions
InvalidOperationExceptionThrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.Remarks
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) { // ... }}Parameters
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.connectionNamestringThe name of the component to retrieve the connection string from the ConnectionStrings configuration section.configureSettingsAction<AzureMessagingWebPubSubSettings>optionalAn optional method that can be used for customizing the AzureMessagingWebPubSubSettings. It's invoked after the settings are read from the configuration.configureClientBuilderAction<IAzureClientBuilder<WebPubSubServiceClient, WebPubSubServiceClientOptions>>optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2.Exceptions
InvalidOperationExceptionThrown when neither AzureMessagingWebPubSubSettings.ConnectionString nor AzureMessagingWebPubSubSettings.Endpoint is provided.Remarks
Reads the configuration from "Aspire.Azure.Messaging.WebPubSub:{name}" section.