Class DiscoveryServiceCollectionExtensions
Inheritance
Namespace: Steeltoe.Discovery.Client
Assembly: Steeltoe.Discovery.ClientBase.dll
Syntax
public static class DiscoveryServiceCollectionExtensions : object
Methods
| Edit this page View SourceAddDiscoveryClient(IServiceCollection, IConfiguration)
Adds service discovery to your application. Uses reflection to determine which clients are available and configured. If no clients are available or configured, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IServiceCollection AddDiscoveryClient(this IServiceCollection services, IConfiguration config = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | |
IConfiguration | config | Application configuration |
Returns
Type | Description |
---|---|
IServiceCollection |
AddDiscoveryClient(IServiceCollection, IConfiguration, IDiscoveryLifecycle)
Adds service discovery to your application. Uses reflection to determine which clients are available and configured. If no clients are available or configured, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IServiceCollection AddDiscoveryClient(this IServiceCollection services, IConfiguration config, IDiscoveryLifecycle lifecycle = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | |
IConfiguration | config | Application configuration |
IDiscoveryLifecycle | lifecycle | Add custom code for app shutdown events |
Returns
Type | Description |
---|---|
IServiceCollection |
AddDiscoveryClient(IServiceCollection, IConfiguration, String, IDiscoveryLifecycle)
Adds service discovery to your application. Uses reflection to determine which clients are available and configured. If no clients are available or configured, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IServiceCollection AddDiscoveryClient(this IServiceCollection services, IConfiguration config, string serviceName = null, IDiscoveryLifecycle lifecycle = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | |
IConfiguration | config | Application configuration |
System.String | serviceName | Specify the name of a service binding to use |
IDiscoveryLifecycle | lifecycle | Add custom code for app shutdown events |
Returns
Type | Description |
---|---|
IServiceCollection |
AddServiceDiscovery(IServiceCollection, Action<DiscoveryClientBuilder>)
Adds service discovery to your application. If builderAction
is not provided, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IServiceCollection AddServiceDiscovery(this IServiceCollection serviceCollection, Action<DiscoveryClientBuilder> builderAction = null)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | serviceCollection | |
Action<DiscoveryClientBuilder> | builderAction | Provided by the desired IDiscoveryClient implementation |
Returns
Type | Description |
---|---|
IServiceCollection |
Remarks
Also configures named HttpClients "DiscoveryRandom" and "DiscoveryRoundRobin" for automatic injection
Exceptions
Type | Condition |
---|---|
ConnectorException | Thrown if no service info with expected name or type are found or when multiple service infos are found and a single was expected |
GetNamedDiscoveryServiceInfo(IConfiguration, String)
Retrieve a single, named
Declaration
public static IServiceInfo GetNamedDiscoveryServiceInfo(IConfiguration config, string serviceName)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | config | The |
System.String | serviceName | Name of service binding to find |
Returns
Type | Description |
---|---|
IServiceInfo |
Exceptions
Type | Condition |
---|---|
ConnectorException | Thrown if no service info with expected name or type are found |
GetSingletonDiscoveryServiceInfo(IConfiguration)
Retrieve a single
Declaration
public static IServiceInfo GetSingletonDiscoveryServiceInfo(IConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
IConfiguration | config | The |
Returns
Type | Description |
---|---|
IServiceInfo |
Exceptions
Type | Condition |
---|---|
ConnectorException | Thrown if multiple service infos are found |