Interface NamingService


  • public interface NamingService
    Naming Service
    Author:
    nkorange
    • Method Detail

      • registerInstance

        void registerInstance​(String serviceName,
                              String ip,
                              int port)
                       throws NacosException
        register a instance to service
        Parameters:
        serviceName - name of service
        ip - instance ip
        port - instance port
        Throws:
        NacosException
      • registerInstance

        void registerInstance​(String serviceName,
                              String groupName,
                              String ip,
                              int port)
                       throws NacosException
        register a instance to service
        Parameters:
        serviceName - name of service
        groupName - group of service
        ip - instance ip
        port - instance port
        Throws:
        NacosException
      • registerInstance

        void registerInstance​(String serviceName,
                              String ip,
                              int port,
                              String clusterName)
                       throws NacosException
        register a instance to service with specified cluster name
        Parameters:
        serviceName - name of service
        ip - instance ip
        port - instance port
        clusterName - instance cluster name
        Throws:
        NacosException
      • registerInstance

        void registerInstance​(String serviceName,
                              String groupName,
                              String ip,
                              int port,
                              String clusterName)
                       throws NacosException
        register a instance to service with specified cluster name
        Parameters:
        serviceName - name of service
        groupName - group of service
        ip - instance ip
        port - instance port
        clusterName - instance cluster name
        Throws:
        NacosException
      • registerInstance

        void registerInstance​(String serviceName,
                              Instance instance)
                       throws NacosException
        register a instance to service with specified instance properties
        Parameters:
        serviceName - name of service
        instance - instance to register
        Throws:
        NacosException
      • registerInstance

        void registerInstance​(String serviceName,
                              String groupName,
                              Instance instance)
                       throws NacosException
        register a instance to service with specified instance properties
        Parameters:
        serviceName - name of service
        groupName - group of service
        instance - instance to register
        Throws:
        NacosException
      • deregisterInstance

        void deregisterInstance​(String serviceName,
                                String ip,
                                int port)
                         throws NacosException
        deregister instance from a service
        Parameters:
        serviceName - name of service
        ip - instance ip
        port - instance port
        Throws:
        NacosException
      • deregisterInstance

        void deregisterInstance​(String serviceName,
                                String groupName,
                                String ip,
                                int port)
                         throws NacosException
        deregister instance from a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        ip - instance ip
        port - instance port
        Throws:
        NacosException
      • deregisterInstance

        void deregisterInstance​(String serviceName,
                                String ip,
                                int port,
                                String clusterName)
                         throws NacosException
        deregister instance with specified cluster name from a service
        Parameters:
        serviceName - name of service
        ip - instance ip
        port - instance port
        clusterName - instance cluster name
        Throws:
        NacosException
      • deregisterInstance

        void deregisterInstance​(String serviceName,
                                String groupName,
                                String ip,
                                int port,
                                String clusterName)
                         throws NacosException
        deregister instance with specified cluster name from a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        ip - instance ip
        port - instance port
        clusterName - instance cluster name
        Throws:
        NacosException
      • deregisterInstance

        void deregisterInstance​(String serviceName,
                                String groupName,
                                Instance instance)
                         throws NacosException
        deregister instance with full instance information
        Parameters:
        serviceName - name of service
        groupName - group of service
        instance - instance information
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       String groupName)
                                throws NacosException
        get all instances of a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        Returns:
        A list of instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       boolean subscribe)
                                throws NacosException
        Get all instances of a service
        Parameters:
        serviceName - name of service
        subscribe - if subscribe the service
        Returns:
        A list of instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       String groupName,
                                       boolean subscribe)
                                throws NacosException
        Get all instances of a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        subscribe - if subscribe the service
        Returns:
        A list of instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       List<String> clusters)
                                throws NacosException
        Get all instances within specified clusters of a service
        Parameters:
        serviceName - name of service
        clusters - list of cluster
        Returns:
        A list of qualified instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       String groupName,
                                       List<String> clusters)
                                throws NacosException
        Get all instances within specified clusters of a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        Returns:
        A list of qualified instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       List<String> clusters,
                                       boolean subscribe)
                                throws NacosException
        Get all instances within specified clusters of a service
        Parameters:
        serviceName - name of service
        clusters - list of cluster
        subscribe - if subscribe the service
        Returns:
        A list of qualified instance
        Throws:
        NacosException
      • getAllInstances

        List<Instance> getAllInstances​(String serviceName,
                                       String groupName,
                                       List<String> clusters,
                                       boolean subscribe)
                                throws NacosException
        Get all instances within specified clusters of a service
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        subscribe - if subscribe the service
        Returns:
        A list of qualified instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       boolean healthy)
                                throws NacosException
        Get qualified instances of service
        Parameters:
        serviceName - name of service
        healthy - a flag to indicate returning healthy or unhealthy instances
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       String groupName,
                                       boolean healthy)
                                throws NacosException
        Get qualified instances of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        healthy - a flag to indicate returning healthy or unhealthy instances
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       boolean healthy,
                                       boolean subscribe)
                                throws NacosException
        Get qualified instances of service
        Parameters:
        serviceName - name of service
        healthy - a flag to indicate returning healthy or unhealthy instances
        subscribe - if subscribe the service
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       String groupName,
                                       boolean healthy,
                                       boolean subscribe)
                                throws NacosException
        Get qualified instances of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        healthy - a flag to indicate returning healthy or unhealthy instances
        subscribe - if subscribe the service
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       List<String> clusters,
                                       boolean healthy)
                                throws NacosException
        Get qualified instances within specified clusters of service
        Parameters:
        serviceName - name of service
        clusters - list of cluster
        healthy - a flag to indicate returning healthy or unhealthy instances
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       String groupName,
                                       List<String> clusters,
                                       boolean healthy)
                                throws NacosException
        Get qualified instances within specified clusters of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        healthy - a flag to indicate returning healthy or unhealthy instances
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       List<String> clusters,
                                       boolean healthy,
                                       boolean subscribe)
                                throws NacosException
        Get qualified instances within specified clusters of service
        Parameters:
        serviceName - name of service
        clusters - list of cluster
        healthy - a flag to indicate returning healthy or unhealthy instances
        subscribe - if subscribe the service
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectInstances

        List<Instance> selectInstances​(String serviceName,
                                       String groupName,
                                       List<String> clusters,
                                       boolean healthy,
                                       boolean subscribe)
                                throws NacosException
        Get qualified instances within specified clusters of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        healthy - a flag to indicate returning healthy or unhealthy instances
        subscribe - if subscribe the service
        Returns:
        A qualified list of instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          String groupName)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        groupName - group of service
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          boolean subscribe)
                                   throws NacosException
        select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        subscribe - if subscribe the service
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          String groupName,
                                          boolean subscribe)
                                   throws NacosException
        select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        groupName - group of service
        subscribe - if subscribe the service
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          List<String> clusters)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        clusters - a list of clusters should the instance belongs to
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          String groupName,
                                          List<String> clusters)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - a list of clusters should the instance belongs to
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          List<String> clusters,
                                          boolean subscribe)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        clusters - a list of clusters should the instance belongs to
        subscribe - if subscribe the service
        Returns:
        qualified instance
        Throws:
        NacosException
      • selectOneHealthyInstance

        Instance selectOneHealthyInstance​(String serviceName,
                                          String groupName,
                                          List<String> clusters,
                                          boolean subscribe)
                                   throws NacosException
        Select one healthy instance of service using predefined load balance strategy
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - a list of clusters should the instance belongs to
        subscribe - if subscribe the service
        Returns:
        qualified instance
        Throws:
        NacosException
      • subscribe

        void subscribe​(String serviceName,
                       EventListener listener)
                throws NacosException
        Subscribe service to receive events of instances alteration
        Parameters:
        serviceName - name of service
        listener - event listener
        Throws:
        NacosException
      • subscribe

        void subscribe​(String serviceName,
                       String groupName,
                       EventListener listener)
                throws NacosException
        Subscribe service to receive events of instances alteration
        Parameters:
        serviceName - name of service
        groupName - group of service
        listener - event listener
        Throws:
        NacosException
      • subscribe

        void subscribe​(String serviceName,
                       List<String> clusters,
                       EventListener listener)
                throws NacosException
        Subscribe service to receive events of instances alteration
        Parameters:
        serviceName - name of service
        clusters - list of cluster
        listener - event listener
        Throws:
        NacosException
      • subscribe

        void subscribe​(String serviceName,
                       String groupName,
                       List<String> clusters,
                       EventListener listener)
                throws NacosException
        Subscribe service to receive events of instances alteration
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        listener - event listener
        Throws:
        NacosException
      • unsubscribe

        void unsubscribe​(String serviceName,
                         String groupName,
                         EventListener listener)
                  throws NacosException
        unsubscribe event listener of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        listener - event listener
        Throws:
        NacosException
      • unsubscribe

        void unsubscribe​(String serviceName,
                         String groupName,
                         List<String> clusters,
                         EventListener listener)
                  throws NacosException
        Unsubscribe event listener of service
        Parameters:
        serviceName - name of service
        groupName - group of service
        clusters - list of cluster
        listener - event listener
        Throws:
        NacosException
      • getServicesOfServer

        ListView<String> getServicesOfServer​(int pageNo,
                                             int pageSize)
                                      throws NacosException
        Get all service names from server
        Parameters:
        pageNo - page index
        pageSize - page size
        Returns:
        list of service names
        Throws:
        NacosException
      • getServicesOfServer

        ListView<String> getServicesOfServer​(int pageNo,
                                             int pageSize,
                                             String groupName)
                                      throws NacosException
        Get all service names from server
        Parameters:
        pageNo - page index
        pageSize - page size
        groupName - group name
        Returns:
        list of service names
        Throws:
        NacosException
      • getServicesOfServer

        ListView<String> getServicesOfServer​(int pageNo,
                                             int pageSize,
                                             AbstractSelector selector)
                                      throws NacosException
        Get all service names from server with selector
        Parameters:
        pageNo - page index
        pageSize - page size
        selector - selector to filter the resource
        Returns:
        list of service names
        Throws:
        NacosException
        Since:
        0.7.0
      • getServicesOfServer

        ListView<String> getServicesOfServer​(int pageNo,
                                             int pageSize,
                                             String groupName,
                                             AbstractSelector selector)
                                      throws NacosException
        Get all service names from server with selector
        Parameters:
        pageNo - page index
        pageSize - page size
        groupName - group name
        selector - selector to filter the resource
        Returns:
        list of service names
        Throws:
        NacosException
      • getServerStatus

        String getServerStatus()
        get server health status
        Returns:
        is server healthy