public class EndpointUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EndpointUtils.DiscoveryUrlType |
static class |
EndpointUtils.InstanceInfoBasedUrlRandomizer |
static interface |
EndpointUtils.ServiceUrlRandomizer |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_REGION |
static java.lang.String |
DEFAULT_ZONE |
Constructor and Description |
---|
EndpointUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.String> |
getDiscoveryServiceUrls(EurekaClientConfig clientConfig,
java.lang.String zone,
EndpointUtils.ServiceUrlRandomizer randomizer)
Get the list of all eureka service urls for the eureka client to talk to.
|
static java.util.Set<java.lang.String> |
getEC2DiscoveryUrlsFromZone(java.lang.String dnsName,
EndpointUtils.DiscoveryUrlType type)
Get the list of EC2 URLs given the zone name.
|
static java.lang.String |
getRegion(EurekaClientConfig clientConfig)
Get the region that this particular instance is in.
|
static java.util.List<java.lang.String> |
getServiceUrlsFromConfig(EurekaClientConfig clientConfig,
java.lang.String instanceZone,
boolean preferSameZone)
Get the list of all eureka service urls from properties file for the eureka client to talk to.
|
static java.util.List<java.lang.String> |
getServiceUrlsFromDNS(EurekaClientConfig clientConfig,
java.lang.String instanceZone,
boolean preferSameZone,
EndpointUtils.ServiceUrlRandomizer randomizer)
Get the list of all eureka service urls from DNS for the eureka client to
talk to.
|
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getServiceUrlsMapFromConfig(EurekaClientConfig clientConfig,
java.lang.String instanceZone,
boolean preferSameZone)
Get the list of all eureka service urls from properties file for the eureka client to talk to.
|
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getZoneBasedDiscoveryUrlsFromRegion(EurekaClientConfig clientConfig,
java.lang.String region)
Get the zone based CNAMES that are bound to a region.
|
public static final java.lang.String DEFAULT_REGION
public static final java.lang.String DEFAULT_ZONE
public static java.util.List<java.lang.String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, java.lang.String zone, EndpointUtils.ServiceUrlRandomizer randomizer)
clientConfig
- the clientConfig to usezone
- the zone in which the client residesrandomizer
- a randomizer to randomized returned urls, if loading from dnspublic static java.util.List<java.lang.String> getServiceUrlsFromDNS(EurekaClientConfig clientConfig, java.lang.String instanceZone, boolean preferSameZone, EndpointUtils.ServiceUrlRandomizer randomizer)
clientConfig
- the clientConfig to useinstanceZone
- The zone in which the client resides.preferSameZone
- true if we have to prefer the same zone as the client, false otherwise.randomizer
- a randomizer to randomized returned urlspublic static java.util.List<java.lang.String> getServiceUrlsFromConfig(EurekaClientConfig clientConfig, java.lang.String instanceZone, boolean preferSameZone)
clientConfig
- the clientConfig to useinstanceZone
- The zone in which the client residespreferSameZone
- true if we have to prefer the same zone as the client, false otherwisepublic static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getServiceUrlsMapFromConfig(EurekaClientConfig clientConfig, java.lang.String instanceZone, boolean preferSameZone)
clientConfig
- the clientConfig to useinstanceZone
- The zone in which the client residespreferSameZone
- true if we have to prefer the same zone as the client, false otherwisepublic static java.util.Set<java.lang.String> getEC2DiscoveryUrlsFromZone(java.lang.String dnsName, EndpointUtils.DiscoveryUrlType type)
dnsName
- The dns name of the zone-specific CNAMEtype
- CNAME or EIP that needs to be retrievedpublic static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getZoneBasedDiscoveryUrlsFromRegion(EurekaClientConfig clientConfig, java.lang.String region)
region
- - The region for which the zone names need to be retrievedpublic static java.lang.String getRegion(EurekaClientConfig clientConfig)