| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using Azure.Core.Extensions; |
| | 5 | | using Azure.Messaging.ServiceBus; |
| | 6 | |
|
| | 7 | | namespace Microsoft.Extensions.Azure |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// The set of extensions to add the Service Bus client types to the clients builder |
| | 11 | | /// </summary> |
| | 12 | | public static class ServiceBusClientBuilderExtensions |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Registers a <see cref="ServiceBusClient "/> instance with the provided <paramref name="connectionString"/> |
| | 16 | | /// </summary> |
| | 17 | | /// |
| | 18 | | public static IAzureClientBuilder<ServiceBusClient, ServiceBusClientOptions> AddServiceBusClient<TBuilder>(this |
| | 19 | | where TBuilder : IAzureClientFactoryBuilder |
| | 20 | | { |
| 0 | 21 | | return builder.RegisterClientFactory<ServiceBusClient, ServiceBusClientOptions>(options => new ServiceBusCli |
| | 22 | | } |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// Registers a <see cref="ServiceBusClient"/> instance with the provided <paramref name="fullyQualifiedNamesp |
| | 26 | | /// </summary> |
| | 27 | | /// |
| | 28 | | public static IAzureClientBuilder<ServiceBusClient, ServiceBusClientOptions> AddServiceBusClientWithNamespace<TB |
| | 29 | | where TBuilder : IAzureClientFactoryBuilderWithCredential |
| | 30 | | { |
| 0 | 31 | | return builder.RegisterClientFactory<ServiceBusClient, ServiceBusClientOptions>((options, token) => new Serv |
| | 32 | | } |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// Registers a <see cref="ServiceBusClient"/> instance with connection options loaded from the provided <para |
| | 36 | | /// </summary> |
| | 37 | | /// |
| | 38 | | public static IAzureClientBuilder<ServiceBusClient, ServiceBusClientOptions> AddServiceBusClient<TBuilder, TConf |
| | 39 | | where TBuilder : IAzureClientFactoryBuilderWithConfiguration<TConfiguration> |
| | 40 | | { |
| 0 | 41 | | return builder.RegisterClientFactory<ServiceBusClient, ServiceBusClientOptions>(configuration); |
| | 42 | | } |
| | 43 | | } |
| | 44 | | } |