Interface EurekaClient

  • All Superinterfaces:
    LookupService
    All Known Implementing Classes:
    DiscoveryClient

    public interface EurekaClient
    extends LookupService
    Define a simple interface over the current DiscoveryClient implementation. This interface does NOT try to clean up the current client interface for eureka 1.x. Rather it tries to provide an easier transition path from eureka 1.x to eureka 2.x. EurekaClient API contracts are: - provide the ability to get InstanceInfo(s) (in various different ways) - provide the ability to get data about the local Client (known regions, own AZ etc) - provide the ability to register and access the healthcheck handler for the client
    • Method Detail

      • getApplicationsForARegion

        Applications getApplicationsForARegion​(@Nullable
                                               java.lang.String region)
        Parameters:
        region - the region that the Applications reside in
        Returns:
        an Applications for the matching region. a Null value is treated as the local region.
      • getApplications

        Applications getApplications​(java.lang.String serviceUrl)
        Get all applications registered with a specific eureka service.
        Parameters:
        serviceUrl - The string representation of the service url.
        Returns:
        The registry information containing all applications.
      • getInstancesByVipAddress

        java.util.List<InstanceInfo> getInstancesByVipAddress​(java.lang.String vipAddress,
                                                              boolean secure)
        Gets the list of instances matching the given VIP Address.
        Parameters:
        vipAddress - The VIP address to match the instances for.
        secure - true if it is a secure vip address, false otherwise
        Returns:
        - The list of InstanceInfo objects matching the criteria
      • getInstancesByVipAddress

        java.util.List<InstanceInfo> getInstancesByVipAddress​(java.lang.String vipAddress,
                                                              boolean secure,
                                                              @Nullable
                                                              java.lang.String region)
        Gets the list of instances matching the given VIP Address in the passed region.
        Parameters:
        vipAddress - The VIP address to match the instances for.
        secure - true if it is a secure vip address, false otherwise
        region - region from which the instances are to be fetched. If null then local region is assumed.
        Returns:
        - The list of InstanceInfo objects matching the criteria, empty list if not instances found.
      • getInstancesByVipAddressAndAppName

        java.util.List<InstanceInfo> getInstancesByVipAddressAndAppName​(java.lang.String vipAddress,
                                                                        java.lang.String appName,
                                                                        boolean secure)
        Gets the list of instances matching the given VIP Address and the given application name if both of them are not null. If one of them is null, then that criterion is completely ignored for matching instances.
        Parameters:
        vipAddress - The VIP address to match the instances for.
        appName - The applicationName to match the instances for.
        secure - true if it is a secure vip address, false otherwise.
        Returns:
        - The list of InstanceInfo objects matching the criteria.
      • getAllKnownRegions

        java.util.Set<java.lang.String> getAllKnownRegions()
        Returns:
        in String form all regions (local + remote) that can be accessed by this client
      • getInstanceRemoteStatus

        InstanceInfo.InstanceStatus getInstanceRemoteStatus()
        Returns:
        the current self instance status as seen on the Eureka server.
      • getDiscoveryServiceUrls

        @Deprecated
        java.util.List<java.lang.String> getDiscoveryServiceUrls​(java.lang.String zone)
        Deprecated.
        see EndpointUtils for replacement Get the list of all eureka service urls for the eureka client to talk to.
        Parameters:
        zone - the zone in which the client resides
        Returns:
        The list of all eureka service urls for the eureka client to talk to.
      • getServiceUrlsFromConfig

        @Deprecated
        java.util.List<java.lang.String> getServiceUrlsFromConfig​(java.lang.String instanceZone,
                                                                  boolean preferSameZone)
        Deprecated.
        see EndpointUtils for replacement Get the list of all eureka service urls from properties file for the eureka client to talk to.
        Parameters:
        instanceZone - The zone in which the client resides
        preferSameZone - true if we have to prefer the same zone as the client, false otherwise
        Returns:
        The list of all eureka service urls for the eureka client to talk to
      • getServiceUrlsFromDNS

        @Deprecated
        java.util.List<java.lang.String> getServiceUrlsFromDNS​(java.lang.String instanceZone,
                                                               boolean preferSameZone)
        Deprecated.
        see EndpointUtils for replacement Get the list of all eureka service urls from DNS for the eureka client to talk to. The client picks up the service url from its zone and then fails over to other zones randomly. If there are multiple servers in the same zone, the client once again picks one randomly. This way the traffic will be distributed in the case of failures.
        Parameters:
        instanceZone - The zone in which the client resides.
        preferSameZone - true if we have to prefer the same zone as the client, false otherwise.
        Returns:
        The list of all eureka service urls for the eureka client to talk to.
      • getHealthCheckHandler

        HealthCheckHandler getHealthCheckHandler()
        Returns:
        the current registered healthcheck handler
      • shutdown

        void shutdown()
        Shuts down Eureka Client. Also sends a deregistration request to the eureka server.
      • getEurekaClientConfig

        EurekaClientConfig getEurekaClientConfig()
        Returns:
        the configuration of this eureka client
      • getApplicationInfoManager

        ApplicationInfoManager getApplicationInfoManager()
        Returns:
        the application info manager of this eureka client