Interface EurekaInstanceConfig
-
- All Known Implementing Classes:
AbstractInstanceConfig,CloudInstanceConfig,MyDataCenterInstanceConfig,PropertiesInstanceConfig
public interface EurekaInstanceConfigConfiguration information required by the instance to register with Eureka server. Once registered, users can look up information fromEurekaClientbased on virtual hostname (also called VIPAddress), the most common way of doing it or by other means to get the information necessary to talk to other instances registered with Eureka.As requirements of registration, an id and an appname must be supplied. The id should be unique within the scope of the appname.
Note that all configurations are not effective at runtime unless and otherwise specified.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetAppGroupName()Get the name of the application group to be registered with eureka.java.lang.StringgetAppname()Get the name of the application to be registered with eureka.java.lang.StringgetASGName()Gets theAWS autoscaling group nameassociated with this instance.DataCenterInfogetDataCenterInfo()Returns the data center this instance is deployed.java.lang.String[]getDefaultAddressResolutionOrder()An instance's network addresses should be fully expressed in it'sDataCenterInfo.java.lang.StringgetHealthCheckUrl()Gets the absolute health check pageURLfor this instance.java.lang.StringgetHealthCheckUrlPath()Gets the relative health checkURLPath for this instance.java.lang.StringgetHomePageUrl()Gets the absolute home pageURLfor this instance.java.lang.StringgetHomePageUrlPath()Gets the relative home pageURLPath for this instance.java.lang.StringgetHostName(boolean refresh)Gets the hostname associated with this instance.java.lang.StringgetInstanceId()Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.java.lang.StringgetIpAddress()Get the IPAdress of the instance.intgetLeaseExpirationDurationInSeconds()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.intgetLeaseRenewalIntervalInSeconds()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 name/value pairs associated with this instance.java.lang.StringgetNamespace()Get the namespace used to find properties.intgetNonSecurePort()Get thenon-secureport on which the instance should receive traffic.java.lang.StringgetSecureHealthCheckUrl()Gets the absolute secure health check pageURLfor this instance.intgetSecurePort()Get theSecure porton which the instance should receive traffic.booleangetSecurePortEnabled()Indicates whether thesecureport should be enabled for traffic or not.java.lang.StringgetSecureVirtualHostName()Gets the secure virtual host name defined for this instance.java.lang.StringgetStatusPageUrl()Gets the absolute status pageURLfor this instance.java.lang.StringgetStatusPageUrlPath()Gets the relative status pageURLPath for this instance.java.lang.StringgetVirtualHostName()Gets the virtual host name defined for this instance.booleanisInstanceEnabledOnit()Indicates whether the instance should be enabled for taking traffic as soon as it is registered with eureka.booleanisNonSecurePortEnabled()Indicates whether thenon-secureport should be enabled for traffic or not.
-
-
-
Method Detail
-
getInstanceId
java.lang.String getInstanceId()
Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.- Returns:
- the (appname scoped) unique id for this instance
-
getAppname
java.lang.String getAppname()
Get the name of the application to be registered with eureka.- Returns:
- string denoting the name.
-
getAppGroupName
java.lang.String getAppGroupName()
Get the name of the application group to be registered with eureka.- Returns:
- string denoting the name.
-
isInstanceEnabledOnit
boolean isInstanceEnabledOnit()
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. :( public API typos are the worst. I think this was meant to be "OnInit".- Returns:
- true to immediately start taking traffic, false otherwise.
-
getNonSecurePort
int getNonSecurePort()
Get thenon-secureport on which the instance should receive traffic.- Returns:
- the non-secure port on which the instance should receive traffic.
-
getSecurePort
int getSecurePort()
Get theSecure porton which the instance should receive traffic.- Returns:
- the secure port on which the instance should receive traffic.
-
isNonSecurePortEnabled
boolean isNonSecurePortEnabled()
Indicates whether thenon-secureport should be enabled for traffic or not.- Returns:
- true if the
non-secureport is enabled, false otherwise.
-
getSecurePortEnabled
boolean getSecurePortEnabled()
Indicates whether thesecureport should be enabled for traffic or not.- Returns:
- true if the
secureport is enabled, false otherwise.
-
getLeaseRenewalIntervalInSeconds
int getLeaseRenewalIntervalInSeconds()
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 ingetLeaseExpirationDurationInSeconds(), 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
HealthCheckCallbackand then decides to make itself unavailable.- Returns:
- time in seconds
-
getLeaseExpirationDurationInSeconds
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.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
getLeaseRenewalIntervalInSeconds().- Returns:
- value indicating time in seconds.
-
getVirtualHostName
java.lang.String getVirtualHostName()
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.
- Returns:
- the string indicating the virtual host name which the clients use to call this service.
-
getSecureVirtualHostName
java.lang.String getSecureVirtualHostName()
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.
- Returns:
- the string indicating the secure virtual host name which the clients use to call this service.
-
getASGName
java.lang.String getASGName()
Gets theAWS autoscaling group nameassociated 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..- Returns:
- the autoscaling group name associated with this instance.
-
getHostName
java.lang.String getHostName(boolean refresh)
Gets the hostname associated with this instance. This is the exact name that would be used by other instances to make calls.- Parameters:
refresh- true if the information needs to be refetched, false otherwise.- Returns:
- hostname of this instance which is identifiable by other instances for making remote calls.
-
getMetadataMap
java.util.Map<java.lang.String,java.lang.String> getMetadataMap()
Gets the metadata name/value pairs associated with this instance. This information is sent to eureka server and can be used by other instances.- Returns:
- Map containing application-specific metadata.
-
getDataCenterInfo
DataCenterInfo getDataCenterInfo()
Returns the data center this instance is deployed. This information is used to get some AWS specific instance information if the instance is deployed in AWS.- Returns:
- information that indicates which data center this instance is deployed in.
-
getIpAddress
java.lang.String getIpAddress()
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 ingetHostName(boolean).- Returns:
- the ip address of this instance.
-
getStatusPageUrlPath
java.lang.String getStatusPageUrlPath()
Gets the relative status pageURLPath for this instance. The status page URL is then constructed out of thegetHostName(boolean)and the type of communication - secure or unsecure as specified ingetSecurePort()andgetNonSecurePort().It is normally used for informational purposes for other services to find about the status of this instance. Users can provide a simple
HTMLindicating what is the current status of the instance.- Returns:
- - relative
URLthat specifies the status page.
-
getStatusPageUrl
java.lang.String getStatusPageUrl()
Gets the absolute status pageURLfor this instance. The users can provide thegetStatusPageUrlPath()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 fullURL. If the fullURLis 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
HTMLindicating what is the current status of the instance. . The fullURLshould follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.- Returns:
- absolute status page URL of this instance.
-
getHomePageUrlPath
java.lang.String getHomePageUrlPath()
Gets the relative home pageURLPath for this instance. The home page URL is then constructed out of thegetHostName(boolean)and the type of communication - secure or unsecure as specified ingetSecurePort()andgetNonSecurePort().It is normally used for informational purposes for other services to use it as a landing page.
- Returns:
- relative
URLthat specifies the home page.
-
getHomePageUrl
java.lang.String getHomePageUrl()
Gets the absolute home pageURLfor this instance. The users can provide thegetHomePageUrlPath()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 fullURL. If the fullURLis provided it takes precedence.It is normally used for informational purposes for other services to use it as a landing page. The full
URLshould follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.- Returns:
- absolute home page URL of this instance.
-
getHealthCheckUrlPath
java.lang.String getHealthCheckUrlPath()
Gets the relative health checkURLPath for this instance. The health check page URL is then constructed out of thegetHostName(boolean)and the type of communication - secure or unsecure as specified ingetSecurePort()andgetNonSecurePort().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.
- Returns:
- - relative
URLthat specifies the health check page.
-
getHealthCheckUrl
java.lang.String getHealthCheckUrl()
Gets the absolute health check pageURLfor this instance. The users can provide thegetHealthCheckUrlPath()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 fullURL. If the fullURLis 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
URLshould follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.- Returns:
- absolute health check page URL of this instance.
-
getSecureHealthCheckUrl
java.lang.String getSecureHealthCheckUrl()
Gets the absolute secure health check pageURLfor this instance. The users can provide thegetSecureHealthCheckUrl()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 fullURL. If the fullURLis 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
URLshould follow the format http://${eureka.hostname}:7001/ where the value ${eureka.hostname} is replaced at runtime.- Returns:
- absolute health check page URL of this instance.
-
getDefaultAddressResolutionOrder
java.lang.String[] getDefaultAddressResolutionOrder()
An instance's network addresses should be fully expressed in it'sDataCenterInfo. For example for instances in AWS, this will include the publicHostname, publicIp, privateHostname and privateIp, when available. TheInstanceInfowill 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.- Returns:
- an ordered list of fields that should be used to preferentially resolve this instance's default address, empty String[] for default.
-
getNamespace
java.lang.String getNamespace()
Get the namespace used to find properties.- Returns:
- the namespace used to find properties.
-
-