Class DiscoveryHostBuilderExtensions
Inheritance
Namespace: Steeltoe.Discovery.Client
Assembly: Steeltoe.Discovery.ClientBase.dll
Syntax
public static class DiscoveryHostBuilderExtensions : object
Methods
| Edit this page View SourceAddDiscoveryClient(IHostBuilder)
Adds service discovery to your application. This method can be used in place of configuration via your Startup class.
Uses reflection to find discovery client packages. If no package is found, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IHostBuilder AddDiscoveryClient(this IHostBuilder hostBuilder)
Parameters
Type | Name | Description |
---|---|---|
IHostBuilder | hostBuilder | Your HostBuilder |
Returns
Type | Description |
---|---|
IHostBuilder |
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 |
AddServiceDiscovery(IHostBuilder, Action<DiscoveryClientBuilder>)
Adds service discovery to your application. This method can be used in place of configuration via your Startup class.
If optionsAction
is not provided, a Steeltoe.Discovery.Client.SimpleClients.NoOpDiscoveryClient will be configured
Declaration
public static IHostBuilder AddServiceDiscovery(this IHostBuilder hostBuilder, Action<DiscoveryClientBuilder> optionsAction)
Parameters
Type | Name | Description |
---|---|---|
IHostBuilder | hostBuilder | Your HostBuilder |
Action<DiscoveryClientBuilder> | optionsAction | Select the discovery client implementation |
Returns
Type | Description |
---|---|
IHostBuilder |
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 |