Class 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 Detail

      • namespace

        protected final java.lang.String namespace
      • configInstance

        protected final com.netflix.config.DynamicPropertyFactory configInstance
    • Constructor Detail

      • PropertiesInstanceConfig

        public PropertiesInstanceConfig()
      • PropertiesInstanceConfig

        public PropertiesInstanceConfig​(java.lang.String namespace)
      • PropertiesInstanceConfig

        public PropertiesInstanceConfig​(java.lang.String namespace,
                                        DataCenterInfo info)
    • 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. :( public API typos are the worst. I think this was meant to be "OnInit".
        Specified by:
        isInstanceEnabledOnit in interface EurekaInstanceConfig
        Overrides:
        isInstanceEnabledOnit in class AbstractInstanceConfig
        Returns:
        true to immediately start taking traffic, false otherwise.
      • 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.
      • getInstanceId

        public java.lang.String getInstanceId()
        Description copied from interface: EurekaInstanceConfig
        Get the unique Id (within the scope of the appName) of this instance to be registered with eureka.
        Specified by:
        getInstanceId in interface EurekaInstanceConfig
        Returns:
        the (appname scoped) unique id for this instance
      • 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
        Returns:
        string denoting the name.
      • getAppGroupName

        public java.lang.String getAppGroupName()
        Description copied from interface: EurekaInstanceConfig
        Get the name of the application group to be registered with eureka.
        Specified by:
        getAppGroupName in interface EurekaInstanceConfig
        Returns:
        string denoting the name.
      • 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.
      • 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.
      • 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.
      • getDefaultAddressResolutionOrder

        public java.lang.String[] getDefaultAddressResolutionOrder()
        Description copied from interface: EurekaInstanceConfig
        An instance's network addresses should be fully expressed in it's 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.
        Specified by:
        getDefaultAddressResolutionOrder in interface EurekaInstanceConfig
        Returns:
        an ordered list of fields that should be used to preferentially resolve this instance's default address, empty String[] for default.
      • shouldBroadcastPublicIpv4Addr

        public boolean shouldBroadcastPublicIpv4Addr()
        Indicates if the public ipv4 address of the instance should be advertised.
        Overrides:
        shouldBroadcastPublicIpv4Addr in class AbstractInstanceConfig
        Returns:
        true if the public ipv4 address of the instance should be advertised, false otherwise .
      • 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.