Class NacosServiceDiscovery
java.lang.Object
com.alibaba.cloud.nacos.discovery.NacosServiceDiscovery
- Author:
- echooymxq, changjin wei(魏昌进)
-
Constructor Summary
ConstructorsConstructorDescriptionNacosServiceDiscovery(NacosDiscoveryProperties discoveryProperties, NacosServiceManager nacosServiceManager) -
Method Summary
Modifier and TypeMethodDescriptionList<org.springframework.cloud.client.ServiceInstance>getInstances(String serviceId) Return all instances for the given service.Return the names of all services.static org.springframework.cloud.client.ServiceInstancehostToServiceInstance(com.alibaba.nacos.api.naming.pojo.Instance instance, String serviceId) static List<org.springframework.cloud.client.ServiceInstance>hostToServiceInstanceList(List<com.alibaba.nacos.api.naming.pojo.Instance> instances, String serviceId)
-
Constructor Details
-
NacosServiceDiscovery
public NacosServiceDiscovery(NacosDiscoveryProperties discoveryProperties, NacosServiceManager nacosServiceManager)
-
-
Method Details
-
getInstances
public List<org.springframework.cloud.client.ServiceInstance> getInstances(String serviceId) throws com.alibaba.nacos.api.exception.NacosException Return all instances for the given service.- Parameters:
serviceId- id of service- Returns:
- list of instances
- Throws:
com.alibaba.nacos.api.exception.NacosException- nacosException
-
getServices
Return the names of all services.- Returns:
- list of service names
- Throws:
com.alibaba.nacos.api.exception.NacosException- nacosException
-
hostToServiceInstanceList
-
hostToServiceInstance
public static org.springframework.cloud.client.ServiceInstance hostToServiceInstance(com.alibaba.nacos.api.naming.pojo.Instance instance, String serviceId)
-