com.netflix.appinfo
Class PropertiesInstanceConfig

java.lang.Object
  extended by com.netflix.appinfo.AbstractInstanceConfig
      extended by com.netflix.appinfo.PropertiesInstanceConfig
All Implemented Interfaces:
EurekaInstanceConfig
Direct Known Subclasses:
CloudInstanceConfig, MyDataCenterInstanceConfig

public abstract class PropertiesInstanceConfig
extends AbstractInstanceConfig
implements EurekaInstanceConfig

A properties based 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-.properties is loaded in addition to eureka-client.properties.


Field Summary
protected  java.lang.String namespace
           
 
Constructor Summary
PropertiesInstanceConfig()
           
PropertiesInstanceConfig(java.lang.String namespace)
           
PropertiesInstanceConfig(java.lang.String namespace, DataCenterInfo info)
           
 
Method Summary
 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 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 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.
 
Methods inherited from class com.netflix.appinfo.AbstractInstanceConfig
getDataCenterInfo, getHostName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.netflix.appinfo.EurekaInstanceConfig
getDataCenterInfo, getHostName
 

Field Detail

namespace

protected java.lang.String namespace
Constructor Detail

PropertiesInstanceConfig

public PropertiesInstanceConfig()

PropertiesInstanceConfig

public PropertiesInstanceConfig(java.lang.String namespace,
                                DataCenterInfo info)

PropertiesInstanceConfig

public PropertiesInstanceConfig(java.lang.String namespace)
Method Detail

isInstanceEnabledOnit

public boolean isInstanceEnabledOnit()
Description copied from interface: EurekaInstanceConfig
Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka. Sometimes the application might need to do some pre-processing before it is ready to take traffic.

Specified by:
isInstanceEnabledOnit in interface EurekaInstanceConfig
Overrides:
isInstanceEnabledOnit in class AbstractInstanceConfig
Returns:
true to immediately start taking traffic, false otherwise.

getNonSecurePort

public int getNonSecurePort()
Description copied from interface: EurekaInstanceConfig
Get the non-secure port on which the instance should receive traffic.

Specified by:
getNonSecurePort in interface EurekaInstanceConfig
Overrides:
getNonSecurePort in class AbstractInstanceConfig
Returns:
the non-secure port on which the instance should receive traffic.

getSecurePort

public int getSecurePort()
Description copied from interface: EurekaInstanceConfig
Get the Secure port on which the instance should receive traffic.

Specified by:
getSecurePort in interface EurekaInstanceConfig
Overrides:
getSecurePort in class AbstractInstanceConfig
Returns:
the non-secure port on which the instance should receive traffic.

isNonSecurePortEnabled

public boolean isNonSecurePortEnabled()
Description copied from interface: EurekaInstanceConfig
Indicates whether the non-secure port should be enabled for traffic or not.

Specified by:
isNonSecurePortEnabled in interface EurekaInstanceConfig
Overrides:
isNonSecurePortEnabled in class AbstractInstanceConfig
Returns:
true if the non-secure port is enabled, false otherwise.

getSecurePortEnabled

public boolean getSecurePortEnabled()
Description copied from interface: EurekaInstanceConfig
Indicates whether the secure port should be enabled for traffic or not.

Specified by:
getSecurePortEnabled in interface EurekaInstanceConfig
Overrides:
getSecurePortEnabled in class AbstractInstanceConfig
Returns:
true if the secure port is enabled, false otherwise.

getLeaseRenewalIntervalInSeconds

public int getLeaseRenewalIntervalInSeconds()
Description copied from interface: EurekaInstanceConfig
Indicates how often (in seconds) the eureka client needs to send heartbeats to eureka server to indicate that it is still alive. If the heartbeats are not received for the period specified in 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.

Specified by:
getLeaseRenewalIntervalInSeconds in interface EurekaInstanceConfig
Overrides:
getLeaseRenewalIntervalInSeconds in class AbstractInstanceConfig
Returns:
time in seconds

getLeaseExpirationDurationInSeconds

public int getLeaseExpirationDurationInSeconds()
Description copied from interface: EurekaInstanceConfig
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.

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() .

Specified by:
getLeaseExpirationDurationInSeconds in interface EurekaInstanceConfig
Overrides:
getLeaseExpirationDurationInSeconds in class AbstractInstanceConfig
Returns:
value indicating time in seconds.

getVirtualHostName

public java.lang.String getVirtualHostName()
Description copied from interface: EurekaInstanceConfig
Gets the virtual host name defined for this instance.

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.

Specified by:
getVirtualHostName in interface EurekaInstanceConfig
Overrides:
getVirtualHostName in class AbstractInstanceConfig
Returns:
the string indicating the virtual host name which the clients use to call this service.

getSecureVirtualHostName

public java.lang.String getSecureVirtualHostName()
Description copied from interface: EurekaInstanceConfig
Gets the secure virtual host name defined for this instance.

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.

Specified by:
getSecureVirtualHostName in interface EurekaInstanceConfig
Overrides:
getSecureVirtualHostName in class AbstractInstanceConfig
Returns:
the string indicating the secure virtual host name which the clients use to call this service.

getASGName

public java.lang.String getASGName()
Description copied from interface: EurekaInstanceConfig
Gets the 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..

Specified by:
getASGName in interface EurekaInstanceConfig
Overrides:
getASGName in class AbstractInstanceConfig
Returns:
the autoscaling group name associated with this instance.

getMetadataMap

public java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
Gets the metadata map associated with the instance. The properties that will be looked up for this will be namespace + ".metadata".

For instance, if the given namespace is eureka.appinfo, the metadata keys are searched under the namespace eureka.appinfo.metadata.

Specified by:
getMetadataMap in interface EurekaInstanceConfig
Overrides:
getMetadataMap in class AbstractInstanceConfig
Returns:
Map containing application-specific metadata.

getAppname

public java.lang.String getAppname()
Description copied from interface: EurekaInstanceConfig
Get the name of the application to be registered with eureka.

Specified by:
getAppname in interface EurekaInstanceConfig
Specified by:
getAppname in class AbstractInstanceConfig
Returns:
string denoting the name.

getIpAddress

public java.lang.String getIpAddress()
Description copied from interface: EurekaInstanceConfig
Get the IPAdress of the instance. This information is for academic purposes only as the communication from other instances primarily happen using the information supplied in EurekaInstanceConfig.getHostName(boolean).

Specified by:
getIpAddress in interface EurekaInstanceConfig
Overrides:
getIpAddress in class AbstractInstanceConfig
Returns:
the ip address of this instance.

getStatusPageUrlPath

public java.lang.String getStatusPageUrlPath()
Description copied from interface: EurekaInstanceConfig
Gets the relative status page 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.

Specified by:
getStatusPageUrlPath in interface EurekaInstanceConfig
Returns:
- relative URL that specifies the status page.

getStatusPageUrl

public java.lang.String getStatusPageUrl()
Description copied from interface: EurekaInstanceConfig
Gets the absolute status page 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.

Specified by:
getStatusPageUrl in interface EurekaInstanceConfig
Returns:
absolute status page URL of this instance.

getHomePageUrlPath

public java.lang.String getHomePageUrlPath()
Description copied from interface: EurekaInstanceConfig
Gets the relative home page 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.

Specified by:
getHomePageUrlPath in interface EurekaInstanceConfig
Returns:
relative URL that specifies the home page.

getHomePageUrl

public java.lang.String getHomePageUrl()
Description copied from interface: EurekaInstanceConfig
Gets the absolute home page 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.

Specified by:
getHomePageUrl in interface EurekaInstanceConfig
Returns:
absolute home page URL of this instance.

getHealthCheckUrlPath

public java.lang.String getHealthCheckUrlPath()
Description copied from interface: EurekaInstanceConfig
Gets the relative health check 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.

Specified by:
getHealthCheckUrlPath in interface EurekaInstanceConfig
Returns:
- relative URL that specifies the health check page.

getHealthCheckUrl

public java.lang.String getHealthCheckUrl()
Description copied from interface: EurekaInstanceConfig
Gets the absolute health check page 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.

Specified by:
getHealthCheckUrl in interface EurekaInstanceConfig
Returns:
absolute health check page URL of this instance.

getSecureHealthCheckUrl

public java.lang.String getSecureHealthCheckUrl()
Description copied from interface: EurekaInstanceConfig
Gets the absolute secure health check page 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.

Specified by:
getSecureHealthCheckUrl in interface EurekaInstanceConfig
Returns:
absolute health check page URL of this instance.

getNamespace

public java.lang.String getNamespace()
Description copied from interface: EurekaInstanceConfig
Get the namespace used to find properties.

Specified by:
getNamespace in interface EurekaInstanceConfig
Returns:
the namespace used to find properties.