mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Merge pull request #1481 from nine-third-repo/master
[Optimize]: NacosRule support group
This commit is contained in:
commit
f6fb6890b9
@ -51,12 +51,13 @@ public class NacosRule extends AbstractLoadBalancerRule {
|
||||
public Server choose(Object key) {
|
||||
try {
|
||||
String clusterName = this.nacosDiscoveryProperties.getClusterName();
|
||||
String group = this.nacosDiscoveryProperties.getGroup();
|
||||
DynamicServerListLoadBalancer loadBalancer = (DynamicServerListLoadBalancer) getLoadBalancer();
|
||||
String name = loadBalancer.getName();
|
||||
|
||||
NamingService namingService = nacosDiscoveryProperties
|
||||
.namingServiceInstance();
|
||||
List<Instance> instances = namingService.selectInstances(name, true);
|
||||
List<Instance> instances = namingService.selectInstances(name, group, true);
|
||||
if (CollectionUtils.isEmpty(instances)) {
|
||||
LOGGER.warn("no instance in service {}", name);
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user