public abstract class PropertiesInstanceConfig extends AbstractInstanceConfig implements EurekaInstanceConfig
InstanceInfo
configuration.
The information required for registration with eureka server is provided in a configuration file.The configuration file is searched for in the classpath with the name specified by the property eureka.client.props and with the suffix .properties. If the property is not specified, eureka-client.properties is assumed as the default.The properties that are looked up uses the namespace passed on to this class.
If the eureka.environment property is specified, additionally
eureka-client-
Modifier and Type | Field and Description |
---|---|
protected com.netflix.config.DynamicPropertyFactory |
configInstance |
protected java.lang.String |
namespace |
DEFAULT_NAMESPACE
Constructor and Description |
---|
PropertiesInstanceConfig() |
PropertiesInstanceConfig(java.lang.String namespace) |
PropertiesInstanceConfig(java.lang.String namespace,
DataCenterInfo info) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAppGroupName()
Get the name of the application group to be registered with eureka.
|
java.lang.String |
getAppname()
Get the name of the application to be registered with eureka.
|
java.lang.String |
getASGName()
Gets the
AWS autoscaling group name associated with this
instance. |
java.lang.String[] |
getDefaultAddressResolutionOrder()
An instance's network addresses should be fully expressed in it's
DataCenterInfo . |
java.lang.String |
getHealthCheckUrl()
Gets the absolute health check page
URL for this instance. |
java.lang.String |
getHealthCheckUrlPath()
Gets the relative health check
URL Path for this
instance. |
java.lang.String |
getHomePageUrl()
Gets the absolute home page
URL for this instance. |
java.lang.String |
getHomePageUrlPath()
Gets the relative home page
URL Path for this instance. |
java.lang.String |
getInstanceId()
Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.
|
java.lang.String |
getIpAddress()
Get the IPAdress of the instance.
|
int |
getLeaseExpirationDurationInSeconds()
Indicates the time in seconds that the eureka server waits since it
received the last heartbeat before it can remove this instance from its
view and there by disallowing traffic to this instance.
|
int |
getLeaseRenewalIntervalInSeconds()
Indicates how often (in seconds) the eureka client needs to send
heartbeats to eureka server to indicate that it is still alive.
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadataMap()
Gets the metadata map associated with the instance.
|
java.lang.String |
getNamespace()
Get the namespace used to find properties.
|
int |
getNonSecurePort()
Get the
non-secure port on which the instance should receive
traffic. |
java.lang.String |
getSecureHealthCheckUrl()
Gets the absolute secure health check page
URL for this instance. |
int |
getSecurePort()
Get the
Secure port on which the instance should receive
traffic. |
boolean |
getSecurePortEnabled()
Indicates whether the
secure port should be enabled for
traffic or not. |
java.lang.String |
getSecureVirtualHostName()
Gets the secure virtual host name defined for this instance.
|
java.lang.String |
getStatusPageUrl()
Gets the absolute status page
URL for this instance. |
java.lang.String |
getStatusPageUrlPath()
Gets the relative status page
URL Path for this
instance. |
java.lang.String |
getVirtualHostName()
Gets the virtual host name defined for this instance.
|
boolean |
isInstanceEnabledOnit()
Indicates whether the instance should be enabled for taking traffic as
soon as it is registered with eureka.
|
boolean |
isNonSecurePortEnabled()
Indicates whether the
non-secure port should be enabled for
traffic or not. |
boolean |
shouldBroadcastPublicIpv4Addr()
Indicates if the public ipv4 address of the instance should be advertised.
|
getDataCenterInfo, getHostName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDataCenterInfo, getHostName
protected final java.lang.String namespace
protected final com.netflix.config.DynamicPropertyFactory configInstance
public PropertiesInstanceConfig()
public PropertiesInstanceConfig(java.lang.String namespace)
public PropertiesInstanceConfig(java.lang.String namespace, DataCenterInfo info)
public boolean isInstanceEnabledOnit()
EurekaInstanceConfig
isInstanceEnabledOnit
in interface EurekaInstanceConfig
isInstanceEnabledOnit
in class AbstractInstanceConfig
public int getNonSecurePort()
EurekaInstanceConfig
non-secure
port on which the instance should receive
traffic.getNonSecurePort
in interface EurekaInstanceConfig
getNonSecurePort
in class AbstractInstanceConfig
public int getSecurePort()
EurekaInstanceConfig
Secure port
on which the instance should receive
traffic.getSecurePort
in interface EurekaInstanceConfig
getSecurePort
in class AbstractInstanceConfig
public boolean isNonSecurePortEnabled()
EurekaInstanceConfig
non-secure
port should be enabled for
traffic or not.isNonSecurePortEnabled
in interface EurekaInstanceConfig
isNonSecurePortEnabled
in class AbstractInstanceConfig
non-secure
port is enabled, false
otherwise.public boolean getSecurePortEnabled()
EurekaInstanceConfig
secure
port should be enabled for
traffic or not.getSecurePortEnabled
in interface EurekaInstanceConfig
getSecurePortEnabled
in class AbstractInstanceConfig
secure
port is enabled, false otherwise.public int getLeaseRenewalIntervalInSeconds()
EurekaInstanceConfig
EurekaInstanceConfig.getLeaseExpirationDurationInSeconds()
, eureka server will remove
the instance from its view, there by disallowing traffic to this
instance.
Note that the instance could still not take traffic if it implements
HealthCheckCallback
and then decides to make itself unavailable.
getLeaseRenewalIntervalInSeconds
in interface EurekaInstanceConfig
getLeaseRenewalIntervalInSeconds
in class AbstractInstanceConfig
public int getLeaseExpirationDurationInSeconds()
EurekaInstanceConfig
Setting this value too long could mean that the traffic could be routed
to the instance even though the instance is not alive. Setting this value
too small could mean, the instance may be taken out of traffic because of
temporary network glitches.This value to be set to atleast higher than
the value specified in EurekaInstanceConfig.getLeaseRenewalIntervalInSeconds()
.
getLeaseExpirationDurationInSeconds
in interface EurekaInstanceConfig
getLeaseExpirationDurationInSeconds
in class AbstractInstanceConfig
public java.lang.String getVirtualHostName()
EurekaInstanceConfig
This is typically the way other instance would find this instance by using the virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.
getVirtualHostName
in interface EurekaInstanceConfig
getVirtualHostName
in class AbstractInstanceConfig
public java.lang.String getSecureVirtualHostName()
EurekaInstanceConfig
This is typically the way other instance would find this instance by using the secure virtual host name.Think of this as similar to the fully qualified domain name, that the users of your services will need to find this instance.
getSecureVirtualHostName
in interface EurekaInstanceConfig
getSecureVirtualHostName
in class AbstractInstanceConfig
public java.lang.String getASGName()
EurekaInstanceConfig
AWS autoscaling group name
associated with this
instance. This information is specifically used in an AWS environment to
automatically put an instance out of service after the instance is
launched and it has been disabled for traffic..getASGName
in interface EurekaInstanceConfig
getASGName
in class AbstractInstanceConfig
public java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
namespace + ".metadata"
.
For instance, if the given namespace is eureka.appinfo
, the
metadata keys are searched under the namespace
eureka.appinfo.metadata
.
getMetadataMap
in interface EurekaInstanceConfig
getMetadataMap
in class AbstractInstanceConfig
public java.lang.String getInstanceId()
EurekaInstanceConfig
getInstanceId
in interface EurekaInstanceConfig
public java.lang.String getAppname()
EurekaInstanceConfig
getAppname
in interface EurekaInstanceConfig
public java.lang.String getAppGroupName()
EurekaInstanceConfig
getAppGroupName
in interface EurekaInstanceConfig
public java.lang.String getIpAddress()
EurekaInstanceConfig
EurekaInstanceConfig.getHostName(boolean)
.getIpAddress
in interface EurekaInstanceConfig
getIpAddress
in class AbstractInstanceConfig
public java.lang.String getStatusPageUrlPath()
EurekaInstanceConfig
URL
Path for this
instance. The status page URL is then constructed out of the
EurekaInstanceConfig.getHostName(boolean)
and the type of communication - secure or
unsecure as specified in EurekaInstanceConfig.getSecurePort()
and
EurekaInstanceConfig.getNonSecurePort()
.
It is normally used for informational purposes for other services to find
about the status of this instance. Users can provide a simple
HTML
indicating what is the current status of the instance.
getStatusPageUrlPath
in interface EurekaInstanceConfig
URL
that specifies the status page.public java.lang.String getStatusPageUrl()
EurekaInstanceConfig
URL
for this instance. The users
can provide the EurekaInstanceConfig.getStatusPageUrlPath()
if the status page
resides in the same instance talking to eureka, else in the cases where
the instance is a proxy for some other server, users can provide the full
URL
. If the full URL
is provided it takes precedence.
* It is normally used for informational purposes for other services to
find about the status of this instance. Users can provide a simple
HTML
indicating what is the current status of the instance.
. The full URL
should follow the format
http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is
replaced at runtime.
getStatusPageUrl
in interface EurekaInstanceConfig
public java.lang.String getHomePageUrlPath()
EurekaInstanceConfig
URL
Path for this instance.
The home page URL is then constructed out of the
EurekaInstanceConfig.getHostName(boolean)
and the type of communication - secure or
unsecure as specified in EurekaInstanceConfig.getSecurePort()
and
EurekaInstanceConfig.getNonSecurePort()
.
It is normally used for informational purposes for other services to use it as a landing page.
getHomePageUrlPath
in interface EurekaInstanceConfig
URL
that specifies the home page.public java.lang.String getHomePageUrl()
EurekaInstanceConfig
URL
for this instance. The users can
provide the EurekaInstanceConfig.getHomePageUrlPath()
if the home page resides in the
same instance talking to eureka, else in the cases where the instance is
a proxy for some other server, users can provide the full URL
. If
the full URL
is provided it takes precedence.
It is normally used for informational purposes for other services to use
it as a landing page. The full URL
should follow the format
http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is
replaced at runtime.
getHomePageUrl
in interface EurekaInstanceConfig
public java.lang.String getHealthCheckUrlPath()
EurekaInstanceConfig
URL
Path for this
instance. The health check page URL is then constructed out of the
EurekaInstanceConfig.getHostName(boolean)
and the type of communication - secure or
unsecure as specified in EurekaInstanceConfig.getSecurePort()
and
EurekaInstanceConfig.getNonSecurePort()
.
It is normally used for making educated decisions based on the health of the instance - for example, it can be used to determine whether to proceed deployments to an entire farm or stop the deployments without causing further damage.
getHealthCheckUrlPath
in interface EurekaInstanceConfig
URL
that specifies the health check page.public java.lang.String getHealthCheckUrl()
EurekaInstanceConfig
URL
for this instance. The
users can provide the EurekaInstanceConfig.getHealthCheckUrlPath()
if the health
check page resides in the same instance talking to eureka, else in the
cases where the instance is a proxy for some other server, users can
provide the full URL
. If the full URL
is provided it
takes precedence.
It is normally used for making educated decisions based on the health of
the instance - for example, it can be used to determine whether to
proceed deployments to an entire farm or stop the deployments without
causing further damage. The full URL
should follow the format
http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is
replaced at runtime.
getHealthCheckUrl
in interface EurekaInstanceConfig
public java.lang.String getSecureHealthCheckUrl()
EurekaInstanceConfig
URL
for this instance.
The users can provide the EurekaInstanceConfig.getSecureHealthCheckUrl()
if the
health check page resides in the same instance talking to eureka, else in
the cases where the instance is a proxy for some other server, users can
provide the full URL
. If the full URL
is provided it
takes precedence.
It is normally used for making educated decisions based on the health of
the instance - for example, it can be used to determine whether to
proceed deployments to an entire farm or stop the deployments without
causing further damage. The full URL
should follow the format
http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is
replaced at runtime.
getSecureHealthCheckUrl
in interface EurekaInstanceConfig
public java.lang.String[] getDefaultAddressResolutionOrder()
EurekaInstanceConfig
DataCenterInfo
.
For example for instances in AWS, this will include the publicHostname, publicIp,
privateHostname and privateIp, when available. The InstanceInfo
will further express a "default address", which is a field that can be configured by the
registering instance to advertise it's default address. This configuration allowed
for the expression of an ordered list of fields that can be used to resolve the default
address. The exact field values will depend on the implementation details of the corresponding
implementing DataCenterInfo types.getDefaultAddressResolutionOrder
in interface EurekaInstanceConfig
public boolean shouldBroadcastPublicIpv4Addr()
shouldBroadcastPublicIpv4Addr
in class AbstractInstanceConfig
public java.lang.String getNamespace()
EurekaInstanceConfig
getNamespace
in interface EurekaInstanceConfig