Package com.alibaba.nacos.api.naming
Interface NamingService
-
public interface NamingServiceNaming Service- Author:
- nkorange
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidderegisterInstance(String serviceName, String ip, int port)deregister instance from a servicevoidderegisterInstance(String serviceName, String ip, int port, String clusterName)deregister instance with specified cluster name from a servicevoidderegisterInstance(String serviceName, String groupName, Instance instance)deregister instance with full instance informationvoidderegisterInstance(String serviceName, String groupName, String ip, int port)deregister instance from a servicevoidderegisterInstance(String serviceName, String groupName, String ip, int port, String clusterName)deregister instance with specified cluster name from a serviceList<Instance>getAllInstances(String serviceName)get all instances of a serviceList<Instance>getAllInstances(String serviceName, boolean subscribe)Get all instances of a serviceList<Instance>getAllInstances(String serviceName, String groupName)get all instances of a serviceList<Instance>getAllInstances(String serviceName, String groupName, boolean subscribe)Get all instances of a serviceList<Instance>getAllInstances(String serviceName, String groupName, List<String> clusters)Get all instances within specified clusters of a serviceList<Instance>getAllInstances(String serviceName, String groupName, List<String> clusters, boolean subscribe)Get all instances within specified clusters of a serviceList<Instance>getAllInstances(String serviceName, List<String> clusters)Get all instances within specified clusters of a serviceList<Instance>getAllInstances(String serviceName, List<String> clusters, boolean subscribe)Get all instances within specified clusters of a serviceStringgetServerStatus()get server health statusListView<String>getServicesOfServer(int pageNo, int pageSize)Get all service names from serverListView<String>getServicesOfServer(int pageNo, int pageSize, AbstractSelector selector)Get all service names from server with selectorListView<String>getServicesOfServer(int pageNo, int pageSize, String groupName)Get all service names from serverListView<String>getServicesOfServer(int pageNo, int pageSize, String groupName, AbstractSelector selector)Get all service names from server with selectorList<ServiceInfo>getSubscribeServices()Get all subscribed services of current clientvoidregisterInstance(String serviceName, Instance instance)register a instance to service with specified instance propertiesvoidregisterInstance(String serviceName, String ip, int port)register a instance to servicevoidregisterInstance(String serviceName, String ip, int port, String clusterName)register a instance to service with specified cluster namevoidregisterInstance(String serviceName, String groupName, Instance instance)register a instance to service with specified instance propertiesvoidregisterInstance(String serviceName, String groupName, String ip, int port)register a instance to servicevoidregisterInstance(String serviceName, String groupName, String ip, int port, String clusterName)register a instance to service with specified cluster nameList<Instance>selectInstances(String serviceName, boolean healthy)Get qualified instances of serviceList<Instance>selectInstances(String serviceName, boolean healthy, boolean subscribe)Get qualified instances of serviceList<Instance>selectInstances(String serviceName, String groupName, boolean healthy)Get qualified instances of serviceList<Instance>selectInstances(String serviceName, String groupName, boolean healthy, boolean subscribe)Get qualified instances of serviceList<Instance>selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy)Get qualified instances within specified clusters of serviceList<Instance>selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy, boolean subscribe)Get qualified instances within specified clusters of serviceList<Instance>selectInstances(String serviceName, List<String> clusters, boolean healthy)Get qualified instances within specified clusters of serviceList<Instance>selectInstances(String serviceName, List<String> clusters, boolean healthy, boolean subscribe)Get qualified instances within specified clusters of serviceInstanceselectOneHealthyInstance(String serviceName)Select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, boolean subscribe)select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, String groupName)Select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, String groupName, boolean subscribe)select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, String groupName, List<String> clusters)Select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, String groupName, List<String> clusters, boolean subscribe)Select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, List<String> clusters)Select one healthy instance of service using predefined load balance strategyInstanceselectOneHealthyInstance(String serviceName, List<String> clusters, boolean subscribe)Select one healthy instance of service using predefined load balance strategyvoidsubscribe(String serviceName, EventListener listener)Subscribe service to receive events of instances alterationvoidsubscribe(String serviceName, String groupName, EventListener listener)Subscribe service to receive events of instances alterationvoidsubscribe(String serviceName, String groupName, List<String> clusters, EventListener listener)Subscribe service to receive events of instances alterationvoidsubscribe(String serviceName, List<String> clusters, EventListener listener)Subscribe service to receive events of instances alterationvoidunsubscribe(String serviceName, EventListener listener)Unsubscribe event listener of servicevoidunsubscribe(String serviceName, String groupName, EventListener listener)unsubscribe event listener of servicevoidunsubscribe(String serviceName, String groupName, List<String> clusters, EventListener listener)Unsubscribe event listener of servicevoidunsubscribe(String serviceName, List<String> clusters, EventListener listener)Unsubscribe event listener of service
-
-
-
Method Detail
-
registerInstance
void registerInstance(String serviceName, String ip, int port) throws NacosException
register a instance to service- Parameters:
serviceName- name of serviceip- instance ipport- 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 servicegroupName- group of serviceip- instance ipport- 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 serviceip- instance ipport- instance portclusterName- 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 servicegroupName- group of serviceip- instance ipport- instance portclusterName- 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 serviceinstance- 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 servicegroupName- group of serviceinstance- 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 serviceip- instance ipport- 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 servicegroupName- group of serviceip- instance ipport- 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 serviceip- instance ipport- instance portclusterName- 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 servicegroupName- group of serviceip- instance ipport- instance portclusterName- 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 servicegroupName- group of serviceinstance- instance information- Throws:
NacosException
-
getAllInstances
List<Instance> getAllInstances(String serviceName) throws NacosException
get all instances of a service- Parameters:
serviceName- name of service- Returns:
- A list of instance
- Throws:
NacosException
-
getAllInstances
List<Instance> getAllInstances(String serviceName, String groupName) throws NacosException
get all instances of a service- Parameters:
serviceName- name of servicegroupName- 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 servicesubscribe- 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 servicegroupName- group of servicesubscribe- 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 serviceclusters- 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 servicegroupName- group of serviceclusters- 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 serviceclusters- list of clustersubscribe- 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 servicegroupName- group of serviceclusters- list of clustersubscribe- 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 servicehealthy- 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 servicegroupName- group of servicehealthy- 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 servicehealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- 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 servicegroupName- group of servicehealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- 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 serviceclusters- list of clusterhealthy- 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 servicegroupName- group of serviceclusters- list of clusterhealthy- 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 serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- 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 servicegroupName- group of serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- 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 servicegroupName- 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 servicesubscribe- 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 servicegroupName- group of servicesubscribe- 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 serviceclusters- 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 servicegroupName- group of serviceclusters- 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 serviceclusters- a list of clusters should the instance belongs tosubscribe- 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 servicegroupName- group of serviceclusters- a list of clusters should the instance belongs tosubscribe- 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 servicelistener- 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 servicegroupName- group of servicelistener- 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 serviceclusters- list of clusterlistener- 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 servicegroupName- group of serviceclusters- list of clusterlistener- event listener- Throws:
NacosException
-
unsubscribe
void unsubscribe(String serviceName, EventListener listener) throws NacosException
Unsubscribe event listener of service- Parameters:
serviceName- name of servicelistener- event listener- Throws:
NacosException
-
unsubscribe
void unsubscribe(String serviceName, String groupName, EventListener listener) throws NacosException
unsubscribe event listener of service- Parameters:
serviceName- name of servicegroupName- group of servicelistener- event listener- Throws:
NacosException
-
unsubscribe
void unsubscribe(String serviceName, List<String> clusters, EventListener listener) throws NacosException
Unsubscribe event listener of service- Parameters:
serviceName- name of serviceclusters- list of clusterlistener- 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 servicegroupName- group of serviceclusters- list of clusterlistener- event listener- Throws:
NacosException
-
getServicesOfServer
ListView<String> getServicesOfServer(int pageNo, int pageSize) throws NacosException
Get all service names from server- Parameters:
pageNo- page indexpageSize- 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 indexpageSize- page sizegroupName- 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 indexpageSize- page sizeselector- 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 indexpageSize- page sizegroupName- group nameselector- selector to filter the resource- Returns:
- list of service names
- Throws:
NacosException
-
getSubscribeServices
List<ServiceInfo> getSubscribeServices() throws NacosException
Get all subscribed services of current client- Returns:
- subscribed services
- Throws:
NacosException
-
getServerStatus
String getServerStatus()
get server health status- Returns:
- is server healthy
-
-