接口 NamingService
public interface NamingService
Naming Service.
- 作者:
- nkorange
-
方法概要
修饰符和类型方法说明voidbatchDeregisterInstance(String serviceName, String groupName, List<Instance> instances) batch deRegister instance to service with specified instance properties.voidbatchRegisterInstance(String serviceName, String groupName, List<Instance> instances) batch register instance to service with specified instance properties.voidcancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher listener) Cancel fuzzy watch, and remove event listener of a pattern.voidcancelFuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) Cancel fuzzy watch, and remove event listener of a pattern.voidderegisterInstance(String serviceName, Instance instance) deregister instance with full instance information and default groupName.voidderegisterInstance(String serviceName, String ip, int port) deregister instance from a service.voidderegisterInstance(String serviceName, String ip, int port, String clusterName) deregister instance with specified cluster name from a service.voidderegisterInstance(String serviceName, String groupName, Instance instance) deregister instance with full instance information.voidderegisterInstance(String serviceName, String groupName, String ip, int port) deregister instance from a service.voidderegisterInstance(String serviceName, String groupName, String ip, int port, String clusterName) deregister instance with specified cluster name from a service.voidfuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher listener) According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope.voidfuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope.fuzzyWatchWithServiceKeys(String groupNamePattern, FuzzyWatchEventWatcher listener) According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope.fuzzyWatchWithServiceKeys(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope.getAllInstances(String serviceName) get all instances of a service.getAllInstances(String serviceName, boolean subscribe) Get all instances of a service.getAllInstances(String serviceName, String groupName) get all instances of a service.getAllInstances(String serviceName, String groupName, boolean subscribe) Get all instances of a service.getAllInstances(String serviceName, String groupName, List<String> clusters) Get all instances within specified clusters of a service.getAllInstances(String serviceName, String groupName, List<String> clusters, boolean subscribe) Get all instances within specified clusters of a service.getAllInstances(String serviceName, List<String> clusters) Get all instances within specified clusters of a service.getAllInstances(String serviceName, List<String> clusters, boolean subscribe) Get all instances within specified clusters of a service.get server health status.getServicesOfServer(int pageNo, int pageSize) Get all service names from server.getServicesOfServer(int pageNo, int pageSize, AbstractSelector selector) Get all service names from server with selector.getServicesOfServer(int pageNo, int pageSize, String groupName) Get all service names from server.getServicesOfServer(int pageNo, int pageSize, String groupName, AbstractSelector selector) Get all service names from server with selector.Get all subscribed services of current client.voidregisterInstance(String serviceName, Instance instance) register an instance to service with specified instance properties.voidregisterInstance(String serviceName, String ip, int port) register an instance to service.voidregisterInstance(String serviceName, String ip, int port, String clusterName) register an instance to service with specified cluster name.voidregisterInstance(String serviceName, String groupName, Instance instance) register an instance to service with specified instance properties.voidregisterInstance(String serviceName, String groupName, String ip, int port) register an instance to service.voidregisterInstance(String serviceName, String groupName, String ip, int port, String clusterName) register an instance to service with specified cluster name.selectInstances(String serviceName, boolean healthy) Get qualified instances of service.selectInstances(String serviceName, boolean healthy, boolean subscribe) Get qualified instances of service.selectInstances(String serviceName, String groupName, boolean healthy) Get qualified instances of service.selectInstances(String serviceName, String groupName, boolean healthy, boolean subscribe) Get qualified instances of service.selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy) Get qualified instances within specified clusters of service.selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy, boolean subscribe) Get qualified instances within specified clusters of service.selectInstances(String serviceName, List<String> clusters, boolean healthy) Get qualified instances within specified clusters of service.selectInstances(String serviceName, List<String> clusters, boolean healthy, boolean subscribe) Get qualified instances within specified clusters of service.selectOneHealthyInstance(String serviceName) Select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, boolean subscribe) select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, String groupName) Select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, String groupName, boolean subscribe) select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters) Select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters, boolean subscribe) Select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, List<String> clusters) Select one healthy instance of service using predefined load balance strategy.selectOneHealthyInstance(String serviceName, List<String> clusters, boolean subscribe) Select one healthy instance of service using predefined load balance strategy.voidshutDown()Shutdown the resource service.voidsubscribe(String serviceName, EventListener listener) Subscribe service to receive events of instances alteration.voidsubscribe(String serviceName, NamingSelector selector, EventListener listener) Subscribe service to receive events of instances alteration.voidsubscribe(String serviceName, String groupName, EventListener listener) Subscribe service to receive events of instances alteration.voidsubscribe(String serviceName, String groupName, NamingSelector selector, EventListener listener) Subscribe service to receive events of instances alteration.voidSubscribe service to receive events of instances alteration.voidsubscribe(String serviceName, List<String> clusters, EventListener listener) Subscribe service to receive events of instances alteration.voidunsubscribe(String serviceName, EventListener listener) Unsubscribe event listener of service.voidunsubscribe(String serviceName, NamingSelector selector, EventListener listener) Unsubscribe event listener of service.voidunsubscribe(String serviceName, String groupName, EventListener listener) unsubscribe event listener of service.voidunsubscribe(String serviceName, String groupName, NamingSelector selector, EventListener listener) Unsubscribe event listener of service.voidunsubscribe(String serviceName, String groupName, List<String> clusters, EventListener listener) Unsubscribe event listener of service.voidunsubscribe(String serviceName, List<String> clusters, EventListener listener) Unsubscribe event listener of service.
-
方法详细资料
-
registerInstance
register an instance to service.- 参数:
serviceName- name of serviceip- instance ipport- instance port- 抛出:
NacosException- nacos exception
-
registerInstance
void registerInstance(String serviceName, String groupName, String ip, int port) throws NacosException register an instance to service.- 参数:
serviceName- name of servicegroupName- group of serviceip- instance ipport- instance port- 抛出:
NacosException- nacos exception
-
registerInstance
void registerInstance(String serviceName, String ip, int port, String clusterName) throws NacosException register an instance to service with specified cluster name.- 参数:
serviceName- name of serviceip- instance ipport- instance portclusterName- instance cluster name- 抛出:
NacosException- nacos exception
-
registerInstance
void registerInstance(String serviceName, String groupName, String ip, int port, String clusterName) throws NacosException register an instance to service with specified cluster name.- 参数:
serviceName- name of servicegroupName- group of serviceip- instance ipport- instance portclusterName- instance cluster name- 抛出:
NacosException- nacos exception
-
registerInstance
register an instance to service with specified instance properties.- 参数:
serviceName- name of serviceinstance- instance to register- 抛出:
NacosException- nacos exception
-
registerInstance
void registerInstance(String serviceName, String groupName, Instance instance) throws NacosException register an instance to service with specified instance properties.- 参数:
serviceName- name of servicegroupName- group of serviceinstance- instance to register- 抛出:
NacosException- nacos exception
-
batchRegisterInstance
void batchRegisterInstance(String serviceName, String groupName, List<Instance> instances) throws NacosException batch register instance to service with specified instance properties.- 参数:
serviceName- name of servicegroupName- group of serviceinstances- instances to register- 抛出:
NacosException- nacos exception- 从以下版本开始:
- 2.1.1
-
batchDeregisterInstance
void batchDeregisterInstance(String serviceName, String groupName, List<Instance> instances) throws NacosException batch deRegister instance to service with specified instance properties.- 参数:
serviceName- name of servicegroupName- group of serviceinstances- instances to deRegister- 抛出:
NacosException- nacos exception- 从以下版本开始:
- 2.2.0
-
deregisterInstance
deregister instance from a service.- 参数:
serviceName- name of serviceip- instance ipport- instance port- 抛出:
NacosException- nacos exception
-
deregisterInstance
void deregisterInstance(String serviceName, String groupName, String ip, int port) throws NacosException deregister instance from a service.- 参数:
serviceName- name of servicegroupName- group of serviceip- instance ipport- instance port- 抛出:
NacosException- nacos exception
-
deregisterInstance
void deregisterInstance(String serviceName, String ip, int port, String clusterName) throws NacosException deregister instance with specified cluster name from a service.- 参数:
serviceName- name of serviceip- instance ipport- instance portclusterName- instance cluster name- 抛出:
NacosException- nacos exception
-
deregisterInstance
void deregisterInstance(String serviceName, String groupName, String ip, int port, String clusterName) throws NacosException deregister instance with specified cluster name from a service.- 参数:
serviceName- name of servicegroupName- group of serviceip- instance ipport- instance portclusterName- instance cluster name- 抛出:
NacosException- nacos exception
-
deregisterInstance
deregister instance with full instance information and default groupName.- 参数:
serviceName- name of serviceinstance- instance- 抛出:
NacosException- nacos exception
-
deregisterInstance
void deregisterInstance(String serviceName, String groupName, Instance instance) throws NacosException deregister instance with full instance information.- 参数:
serviceName- name of servicegroupName- group of serviceinstance- instance information- 抛出:
NacosException- nacos exception
-
getAllInstances
get all instances of a service.- 参数:
serviceName- name of service- 返回:
- A list of instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
get all instances of a service.- 参数:
serviceName- name of servicegroupName- group of service- 返回:
- A list of instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
Get all instances of a service.- 参数:
serviceName- name of servicesubscribe- if subscribe the service- 返回:
- A list of instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
List<Instance> getAllInstances(String serviceName, String groupName, boolean subscribe) throws NacosException Get all instances of a service.- 参数:
serviceName- name of servicegroupName- group of servicesubscribe- if subscribe the service- 返回:
- A list of instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
Get all instances within specified clusters of a service.- 参数:
serviceName- name of serviceclusters- list of cluster- 返回:
- A list of qualified instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
List<Instance> getAllInstances(String serviceName, String groupName, List<String> clusters) throws NacosException Get all instances within specified clusters of a service.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of cluster- 返回:
- A list of qualified instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
List<Instance> getAllInstances(String serviceName, List<String> clusters, boolean subscribe) throws NacosException Get all instances within specified clusters of a service.- 参数:
serviceName- name of serviceclusters- list of clustersubscribe- if subscribe the service- 返回:
- A list of qualified instance
- 抛出:
NacosException- nacos exception
-
getAllInstances
List<Instance> getAllInstances(String serviceName, String groupName, List<String> clusters, boolean subscribe) throws NacosException Get all instances within specified clusters of a service.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of clustersubscribe- if subscribe the service- 返回:
- A list of qualified instance
- 抛出:
NacosException- nacos exception
-
selectInstances
Get qualified instances of service.- 参数:
serviceName- name of service.healthy- a flag to indicate returning healthy or unhealthy instances- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, String groupName, boolean healthy) throws NacosException Get qualified instances of service.- 参数:
serviceName- name of servicegroupName- group of servicehealthy- a flag to indicate returning healthy or unhealthy instances- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, boolean healthy, boolean subscribe) throws NacosException Get qualified instances of service.- 参数:
serviceName- name of servicehealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- if subscribe the service- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, String groupName, boolean healthy, boolean subscribe) throws NacosException Get qualified instances of service.- 参数:
serviceName- name of servicegroupName- group of servicehealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- if subscribe the service- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, List<String> clusters, boolean healthy) throws NacosException Get qualified instances within specified clusters of service.- 参数:
serviceName- name of serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instances- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy) throws NacosException Get qualified instances within specified clusters of service.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instances- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectInstances
List<Instance> selectInstances(String serviceName, List<String> clusters, boolean healthy, boolean subscribe) throws NacosException Get qualified instances within specified clusters of service.- 参数:
serviceName- name of serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- if subscribe the service- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
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.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of clusterhealthy- a flag to indicate returning healthy or unhealthy instancessubscribe- if subscribe the service- 返回:
- A qualified list of instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of servicegroupName- group of service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of servicesubscribe- if subscribe the service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Instance selectOneHealthyInstance(String serviceName, String groupName, boolean subscribe) throws NacosException select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of servicegroupName- group of servicesubscribe- if subscribe the service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of serviceclusters- a list of clusters should the instance belongs to- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Instance selectOneHealthyInstance(String serviceName, String groupName, List<String> clusters) throws NacosException Select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- a list of clusters should the instance belongs to- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
selectOneHealthyInstance
Instance selectOneHealthyInstance(String serviceName, List<String> clusters, boolean subscribe) throws NacosException Select one healthy instance of service using predefined load balance strategy.- 参数:
serviceName- name of serviceclusters- a list of clusters should the instance belongs tosubscribe- if subscribe the service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
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.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- a list of clusters should the instance belongs tosubscribe- if subscribe the service- 返回:
- qualified instance
- 抛出:
NacosException- nacos exception
-
subscribe
Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of servicelistener- event listener- 抛出:
NacosException- nacos exception
-
subscribe
Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of servicegroupName- group of servicelistener- event listener- 抛出:
NacosException- nacos exception
-
subscribe
void subscribe(String serviceName, List<String> clusters, EventListener listener) throws NacosException Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of serviceclusters- list of clusterlistener- event listener- 抛出:
NacosException- nacos exception
-
subscribe
void subscribe(String serviceName, String groupName, List<String> clusters, EventListener listener) throws NacosException Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of clusterlistener- event listener- 抛出:
NacosException- nacos exception
-
subscribe
void subscribe(String serviceName, NamingSelector selector, EventListener listener) throws NacosException Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of serviceselector- selector of instanceslistener- event listener- 抛出:
NacosException- nacos exception
-
subscribe
void subscribe(String serviceName, String groupName, NamingSelector selector, EventListener listener) throws NacosException Subscribe service to receive events of instances alteration.- 参数:
serviceName- name of servicegroupName- group of serviceselector- selector of instanceslistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
Unsubscribe event listener of service.- 参数:
serviceName- name of servicelistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
void unsubscribe(String serviceName, String groupName, EventListener listener) throws NacosException unsubscribe event listener of service.- 参数:
serviceName- name of servicegroupName- group of servicelistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
void unsubscribe(String serviceName, List<String> clusters, EventListener listener) throws NacosException Unsubscribe event listener of service.- 参数:
serviceName- name of serviceclusters- list of clusterlistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
void unsubscribe(String serviceName, String groupName, List<String> clusters, EventListener listener) throws NacosException Unsubscribe event listener of service.- 参数:
serviceName- name of servicegroupName- group of serviceclusters- list of clusterlistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
void unsubscribe(String serviceName, NamingSelector selector, EventListener listener) throws NacosException Unsubscribe event listener of service.- 参数:
serviceName- name of serviceselector- selector of instanceslistener- event listener- 抛出:
NacosException- nacos exception
-
unsubscribe
void unsubscribe(String serviceName, String groupName, NamingSelector selector, EventListener listener) throws NacosException Unsubscribe event listener of service.- 参数:
serviceName- name of servicegroupName- group of serviceselector- selector of instanceslistener- event listener- 抛出:
NacosException- nacos exception
-
fuzzyWatch
According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope. When given a fixed group name, watch changes in all services under this group.- 参数:
groupNamePattern- group name pattern for fuzzy watchlistener- event listener- 抛出:
NacosException- nacos exception
-
fuzzyWatch
void fuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope. When provided with a fixed group name and pattern of service name, watch changes in services under this group that match the specified pattern.- 参数:
serviceNamePattern- service name pattern for fuzzy watchgroupNamePattern- group name pattern for fuzzy watchlistener- event listener- 抛出:
NacosException- nacos exception
-
fuzzyWatchWithServiceKeys
Future<ListView<String>> fuzzyWatchWithServiceKeys(String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope. When given a fixed group name, watch changes in all services under this group.- 参数:
groupNamePattern- group name pattern for fuzzy watchlistener- event listener- 返回:
- matched service keys.
- 抛出:
NacosException- nacos exception
-
fuzzyWatchWithServiceKeys
Future<ListView<String>> fuzzyWatchWithServiceKeys(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException According to matching rules, watch services within a specific scope, and receive notifications when changes occur in the services within the scope. When provided with a fixed group name and pattern of service name, watch changes in services under this group that match the specified pattern.- 参数:
serviceNamePattern- service name pattern for fuzzy watchgroupNamePattern- group name pattern for fuzzy watchlistener- event listener- 返回:
- matched service keys.
- 抛出:
NacosException- nacos exception
-
cancelFuzzyWatch
void cancelFuzzyWatch(String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException Cancel fuzzy watch, and remove event listener of a pattern.- 参数:
groupNamePattern- group name for fuzzy watchlistener- event listener- 抛出:
NacosException- nacos exception
-
cancelFuzzyWatch
void cancelFuzzyWatch(String serviceNamePattern, String groupNamePattern, FuzzyWatchEventWatcher listener) throws NacosException Cancel fuzzy watch, and remove event listener of a pattern.- 参数:
serviceNamePattern- service name pattern for fuzzy watchgroupNamePattern- fixed group name for fuzzy watchlistener- event listener- 抛出:
NacosException- nacos exception
-
getServicesOfServer
Get all service names from server.- 参数:
pageNo- page indexpageSize- page size- 返回:
- list of service names
- 抛出:
NacosException- nacos exception
-
getServicesOfServer
ListView<String> getServicesOfServer(int pageNo, int pageSize, String groupName) throws NacosException Get all service names from server.- 参数:
pageNo- page indexpageSize- page sizegroupName- group name- 返回:
- list of service names
- 抛出:
NacosException- nacos exception
-
getServicesOfServer
ListView<String> getServicesOfServer(int pageNo, int pageSize, AbstractSelector selector) throws NacosException Get all service names from server with selector.- 参数:
pageNo- page indexpageSize- page sizeselector- selector to filter the resource- 返回:
- list of service names
- 抛出:
NacosException- nacos exception- 从以下版本开始:
- 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.- 参数:
pageNo- page indexpageSize- page sizegroupName- group nameselector- selector to filter the resource- 返回:
- list of service names
- 抛出:
NacosException- nacos exception
-
getSubscribeServices
Get all subscribed services of current client.- 返回:
- subscribed services
- 抛出:
NacosException- nacos exception
-
getServerStatus
String getServerStatus()get server health status.- 返回:
- is server healthy
-
shutDown
Shutdown the resource service.- 抛出:
NacosException- exception.
-