Class CompositeDiscoveryClient
- java.lang.Object
-
- org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient
-
- All Implemented Interfaces:
DiscoveryClient
,org.springframework.core.Ordered
public class CompositeDiscoveryClient extends Object implements DiscoveryClient
ADiscoveryClient
that is composed of other discovery clients and delegates calls to each of them in order.- Author:
- Biju Kunjummen, Olga Maciaszek-Sharma, Sean Ruffatti
-
-
Field Summary
-
Fields inherited from interface org.springframework.cloud.client.discovery.DiscoveryClient
DEFAULT_ORDER
-
-
Constructor Summary
Constructors Constructor Description CompositeDiscoveryClient(List<DiscoveryClient> discoveryClients)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
description()
A human-readable description of the implementation, used in HealthIndicator.List<DiscoveryClient>
getDiscoveryClients()
List<ServiceInstance>
getInstances(String serviceId)
Gets all ServiceInstances associated with a particular serviceId.List<String>
getServices()
void
probe()
Can be used to verify the client is valid and able to make calls.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.springframework.cloud.client.discovery.DiscoveryClient
getOrder
-
-
-
-
Constructor Detail
-
CompositeDiscoveryClient
public CompositeDiscoveryClient(List<DiscoveryClient> discoveryClients)
-
-
Method Detail
-
description
public String description()
Description copied from interface:DiscoveryClient
A human-readable description of the implementation, used in HealthIndicator.- Specified by:
description
in interfaceDiscoveryClient
- Returns:
- The description.
-
getInstances
public List<ServiceInstance> getInstances(String serviceId)
Description copied from interface:DiscoveryClient
Gets all ServiceInstances associated with a particular serviceId.- Specified by:
getInstances
in interfaceDiscoveryClient
- Parameters:
serviceId
- The serviceId to query.- Returns:
- A List of ServiceInstance.
-
getServices
public List<String> getServices()
- Specified by:
getServices
in interfaceDiscoveryClient
- Returns:
- All known service IDs.
-
probe
public void probe()
Description copied from interface:DiscoveryClient
Can be used to verify the client is valid and able to make calls.A successful invocation with no exception thrown implies the client is able to make calls.
The default implementation simply calls
DiscoveryClient.getServices()
- client implementations can override with a lighter weight operation if they choose to.- Specified by:
probe
in interfaceDiscoveryClient
-
getDiscoveryClients
public List<DiscoveryClient> getDiscoveryClients()
-
-