/** * register a instance to service * * @param serviceName name of service * @param ip instance ip * @param port instance port * @throws NacosException */ voidregisterInstance(String serviceName, String ip, int port)throws NacosException;
/** * register a instance to service * * @param serviceName name of service * @param groupName group of service * @param ip instance ip * @param port instance port * @throws NacosException */ voidregisterInstance(String serviceName, String groupName, String ip, int port)throws NacosException;
返回的是Instance
1 2 3 4 5 6 7 8 9 10 11
/** * get all instances of a service * * @param serviceName name of service * @return A list of instance * @throws NacosException */ 服务名 是否健康 List<Instance> getAllInstances(String serviceName)throws NacosException; Ribbon-->server Eureka==>ServiceInstance
publicvoidregister(Registration registration){ if (StringUtils.isEmpty(registration.getServiceId())) { log.warn("No service to register for nacos client..."); } else { String serviceId = registration.getServiceId(); //this.getNacosInstanceFromRegistration get set Instance instance = this.getNacosInstanceFromRegistration(registration);