|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.discovery.DiscoveryClient
public class DiscoveryClient
The class that is instrumental for interactions with Eureka Server.
Eureka Client is responsible for a) Registering the instance with Eureka Server b) Renewalof the lease with Eureka Server c) Cancellation of the lease from Eureka Server during shutdown
d) Querying the list of services/instances registered with Eureka Server
Eureka Client needs a configured list of Eureka Server
URLs to talk to.These URLs are typically amazon elastic eips
which do not change. All of the functions defined above fail-over to other
URLs specified in the list in the case of failure.
| Nested Class Summary | |
|---|---|
static class |
DiscoveryClient.DiscoveryUrlType
|
| Field Summary | |
|---|---|
protected static EurekaClientConfig |
clientConfig
|
| Method Summary | |
|---|---|
java.util.Set<java.lang.String> |
getAllKnownRegions()
|
Application |
getApplication(java.lang.String appName)
Returns the corresponding Application object which is basically a
container of all registered appName InstanceInfos. |
Applications |
getApplications()
(non-Javadoc) |
Applications |
getApplications(java.lang.String serviceUrl)
Get all applications registered with a specific eureka service. |
Applications |
getApplicationsForARegion(java.lang.String region)
|
java.util.List<java.lang.String> |
getDiscoveryServiceUrls(java.lang.String zone)
|
static java.util.Set<java.lang.String> |
getEC2DiscoveryUrlsFromZone(java.lang.String dnsName,
DiscoveryClient.DiscoveryUrlType type)
Get the list of EC2 URLs given the zone name |
static java.util.List<java.lang.String> |
getEurekaServiceUrlsFromConfig(java.lang.String instanceZone,
boolean preferSameZone)
Get the list of all eureka service urls from properties file for the eureka client to talk to |
java.util.List<InstanceInfo> |
getInstancesById(java.lang.String id)
Returns the List of InstanceInfos matching the the passed
in id. |
java.util.List<InstanceInfo> |
getInstancesByVipAddress(java.lang.String vipAddress,
boolean secure)
Gets the list of instances matching the given VIP Address. |
java.util.List<InstanceInfo> |
getInstancesByVipAddress(java.lang.String vipAddress,
boolean secure,
java.lang.String region)
Gets the list of instances matching the given VIP Address in the passed region. |
java.util.List<InstanceInfo> |
getInstancesByVipAddressAndAppName(java.lang.String vipAddress,
java.lang.String appName,
boolean secure)
Gets the list of instances matching the given VIP Address and the given application name if both of them are not null. |
InstanceInfo |
getNextServerFromEureka(java.lang.String virtualHostname,
boolean secure)
Gets the next possible server to process the requests from the registry information received from eureka. |
static java.lang.String |
getRegion()
Get the region that this particular instance is in. |
java.util.List<java.lang.String> |
getServiceUrlsFromDNS(java.lang.String instanceZone,
boolean preferSameZone)
Get the list of all eureka service urls from DNS for the eureka client to talk to. |
static java.lang.String |
getZone(InstanceInfo myInfo)
Get the zone that a particular instance is in. |
protected BackupRegistry |
newBackupRegistryInstance()
|
void |
registerHealthCheckCallback(HealthCheckCallback callback)
Register HealthCheckCallback with the eureka client. |
void |
shutdown()
Shuts down Eureka Client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static EurekaClientConfig clientConfig
| Method Detail |
|---|
public Application getApplication(java.lang.String appName)
LookupServiceApplication object which is basically a
container of all registered appName InstanceInfos.
getApplication in interface LookupServiceApplication or null if we couldn't locate any app of
the requested appNamepublic Applications getApplications()
getApplications in interface LookupServiceApplicationsLookupService.getApplications()
public Applications getApplicationsForARegion(@Nullable
java.lang.String region)
public java.util.Set<java.lang.String> getAllKnownRegions()
public java.util.List<InstanceInfo> getInstancesById(java.lang.String id)
LookupServiceList of InstanceInfos matching the the passed
in id. A single InstanceInfo can possibly be registered w/ more
than one Applications
getInstancesById in interface LookupServiceList of InstanceInfos or
Collections.emptyList()public void registerHealthCheckCallback(HealthCheckCallback callback)
HealthCheckCallback with the eureka client.
Once registered, the eureka client will invoke the
HealthCheckCallback in intervals specified by
EurekaClientConfig.getInstanceInfoReplicationIntervalSeconds().
callback - -- app specific healthcheck.
public java.util.List<InstanceInfo> getInstancesByVipAddress(java.lang.String vipAddress,
boolean secure)
vipAddress - - The VIP address to match the instances for.secure - - true if it is a secure vip address, false otherwise
InstanceInfo objects matching the criteria
public java.util.List<InstanceInfo> getInstancesByVipAddress(java.lang.String vipAddress,
boolean secure,
@Nullable
java.lang.String region)
vipAddress - - The VIP address to match the instances for.secure - - true if it is a secure vip address, false otherwiseregion - - region from which the instances are to be fetched. If null then local region is
assumed.
InstanceInfo objects matching the criteria, empty list if not instances found.
public java.util.List<InstanceInfo> getInstancesByVipAddressAndAppName(java.lang.String vipAddress,
java.lang.String appName,
boolean secure)
vipAddress - - The VIP address to match the instances for.appName - - The applicationName to match the instances for.secure - - true if it is a secure vip address, false otherwise.
InstanceInfo objects matching the criteria.
public InstanceInfo getNextServerFromEureka(java.lang.String virtualHostname,
boolean secure)
LookupService
The next server is picked on a round-robin fashion.By default, this
method just returns the servers that are currently with
InstanceInfo.InstanceStatus.UP status. This configuration can be controlled by
overriding the EurekaClientConfig.shouldFilterOnlyUpInstances().
Note that in some cases (Eureka emergency mode situation), the instances
that are returned may not be unreachable, it is solely up to the client
at that point to timeout quickly and retry the next server.
getNextServerFromEureka in interface LookupServicevirtualHostname - the virtual host name that is associated to the servers.secure - indicates whether this is a HTTP or a HTTPS request - secure
means HTTPS.
InstanceInfo information which contains the public
host name of the next server in line to process the request based
on the round-robin algorithm.public Applications getApplications(java.lang.String serviceUrl)
serviceUrl - - The string representation of the service url.
public static java.util.List<java.lang.String> getEurekaServiceUrlsFromConfig(java.lang.String instanceZone,
boolean preferSameZone)
instanceZone - - The zone in which the client residespreferSameZone - - true if we have to prefer the same zone as the client, false
otherwise
public void shutdown()
public java.util.List<java.lang.String> getServiceUrlsFromDNS(java.lang.String instanceZone,
boolean preferSameZone)
instanceZone - - The zone in which the client resides.preferSameZone - - true if we have to prefer the same zone as the client, false
otherwise.
public java.util.List<java.lang.String> getDiscoveryServiceUrls(java.lang.String zone)
public static java.lang.String getZone(InstanceInfo myInfo)
myInfo - - The InstanceInfo object of the instance.
public static java.lang.String getRegion()
public static java.util.Set<java.lang.String> getEC2DiscoveryUrlsFromZone(java.lang.String dnsName,
DiscoveryClient.DiscoveryUrlType type)
dnsName - - The dns name of the zone-specific CNAMEtype - - CNAME or EIP that needs to be retrieved
@Nullable
protected BackupRegistry newBackupRegistryInstance()
throws java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||