Class ConsulDiscoveryClient
A IDiscoveryClient implementation for Consul
Inheritance
Namespace: Steeltoe.Discovery.Consul.Discovery
Assembly: Steeltoe.Discovery.Consul.dll
Syntax
public class ConsulDiscoveryClient : object, IConsulDiscoveryClient, IDiscoveryClient
Constructors
| Edit this page View SourceConsulDiscoveryClient(IConsulClient, IOptionsMonitor<ConsulDiscoveryOptions>, IConsulServiceRegistrar, ILogger<ConsulDiscoveryClient>)
Initializes a new instance of the ConsulDiscoveryClient class.
Declaration
public ConsulDiscoveryClient(IConsulClient client, IOptionsMonitor<ConsulDiscoveryOptions> optionsMonitor, IConsulServiceRegistrar registrar = null, ILogger<ConsulDiscoveryClient> logger = null)
Parameters
Type | Name | Description |
---|---|---|
IConsulClient | client | a Consule client |
IOptionsMonitor<ConsulDiscoveryOptions> | optionsMonitor | the configuration options |
IConsulServiceRegistrar | registrar | a Consul registrar service |
ILogger<ConsulDiscoveryClient> | logger | optional logger |
ConsulDiscoveryClient(IConsulClient, ConsulDiscoveryOptions, IConsulServiceRegistrar, ILogger<ConsulDiscoveryClient>)
Initializes a new instance of the ConsulDiscoveryClient class.
Declaration
public ConsulDiscoveryClient(IConsulClient client, ConsulDiscoveryOptions options, IConsulServiceRegistrar registrar = null, ILogger<ConsulDiscoveryClient> logger = null)
Parameters
Type | Name | Description |
---|---|---|
IConsulClient | client | a Consul client |
ConsulDiscoveryOptions | options | the configuration options |
IConsulServiceRegistrar | registrar | a Consul registrar service |
ILogger<ConsulDiscoveryClient> | logger | optional logger |
Properties
| Edit this page View SourceDescription
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
Services
Declaration
public IList<string> Services { get; }
Property Value
Type | Description |
---|---|
IList<System.String> |
Methods
| Edit this page View SourceDispose()
Dispose of the client and also the Consul service registrar if provided
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Finalize()
Declaration
protected void Finalize()
GetAllInstances(QueryOptions)
Returns all instances for all services
Declaration
public IList<IServiceInstance> GetAllInstances(QueryOptions queryOptions = null)
Parameters
Type | Name | Description |
---|---|---|
QueryOptions | queryOptions | any Consul query options to use when doing lookup |
Returns
Type | Description |
---|---|
IList<IServiceInstance> | the list of service instances |
GetInstances(String)
Declaration
public IList<IServiceInstance> GetInstances(string serviceId)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceId |
Returns
Type | Description |
---|---|
IList<IServiceInstance> |
GetInstances(String, QueryOptions)
Returns the instances for the provided service id
Declaration
public IList<IServiceInstance> GetInstances(string serviceId, QueryOptions queryOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceId | the service id to get instances for |
QueryOptions | queryOptions | any Consul query options to use when doing lookup |
Returns
Type | Description |
---|---|
IList<IServiceInstance> | the list of service instances |
GetLocalServiceInstance()
Declaration
public IServiceInstance GetLocalServiceInstance()
Returns
Type | Description |
---|---|
IServiceInstance |
GetServices(QueryOptions)
Returns a list of service names in the catalog
Declaration
public IList<string> GetServices(QueryOptions queryOptions = null)
Parameters
Type | Name | Description |
---|---|---|
QueryOptions | queryOptions | any Consul query options to use when doing lookup |
Returns
Type | Description |
---|---|
IList<System.String> | the list of services |
ShutdownAsync()
Declaration
public Task ShutdownAsync()
Returns
Type | Description |
---|---|
Task |