Skip to content

Commit

Permalink
fixed review options
Browse files Browse the repository at this point in the history
  • Loading branch information
chengyouling committed Nov 16, 2023
1 parent 87f71b8 commit f2c4b71
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spring:
servicecomb:
cross-group:
enabled: true
groupServiceMapping:
service-group-mappings:
price: DEFAULT_GROUP
nacos:
discovery:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
@ConditionalOnProperty(value = "spring.cloud.servicecomb.cross-group.enabled", havingValue = "true")
public class NacosCrossGroupAutoConfiguration {
@Bean
public NacosServiceDiscoveryExtends nacosServiceDiscoveryExtends(NacosDiscoveryProperties discoveryProperties,
public NacosServiceCrossGroupDiscovery nacosServiceDiscoveryExtends(NacosDiscoveryProperties discoveryProperties,
NacosServiceManager nacosServiceManager, NacosCrossGroupServiceConfig nacosCrossGroupServiceConfig) {
return new NacosServiceDiscoveryExtends(discoveryProperties, nacosServiceManager, nacosCrossGroupServiceConfig);
return new NacosServiceCrossGroupDiscovery(discoveryProperties, nacosServiceManager, nacosCrossGroupServiceConfig);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
public class NacosCrossGroupServiceConfig {
private boolean enabled;

private Map<String, String> groupServiceMapping = new HashMap<>();

public Map<String, String> getGroupServiceMapping() {
return groupServiceMapping;
public Map<String, String> getServiceGroupMappings() {
return serviceGroupMappings;
}

public void setGroupServiceMapping(Map<String, String> groupServiceMapping) {
this.groupServiceMapping = groupServiceMapping;
public void setServiceGroupMappings(Map<String, String> serviceGroupMappings) {
this.serviceGroupMappings = serviceGroupMappings;
}

private Map<String, String> serviceGroupMappings = new HashMap<>();

public boolean isEnabled() {
return enabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.pojo.Instance;

public class NacosServiceDiscoveryExtends extends NacosServiceDiscovery {
public class NacosServiceCrossGroupDiscovery extends NacosServiceDiscovery {
private final NacosServiceManager nacosServiceManager;

private final NacosCrossGroupServiceConfig nacosCrossGroupServiceConfig;

public NacosServiceDiscoveryExtends(NacosDiscoveryProperties discoveryProperties,
public NacosServiceCrossGroupDiscovery(NacosDiscoveryProperties discoveryProperties,
NacosServiceManager nacosServiceManager, NacosCrossGroupServiceConfig nacosCrossGroupServiceConfig) {
super(discoveryProperties, nacosServiceManager);
this.nacosServiceManager = nacosServiceManager;
Expand All @@ -40,8 +40,8 @@ public NacosServiceDiscoveryExtends(NacosDiscoveryProperties discoveryProperties

@Override
public List<ServiceInstance> getInstances(String serviceId) throws NacosException {
if (nacosCrossGroupServiceConfig.getGroupServiceMapping().containsKey(serviceId)) {
String group = nacosCrossGroupServiceConfig.getGroupServiceMapping().get(serviceId);
if (nacosCrossGroupServiceConfig.getServiceGroupMappings().containsKey(serviceId)) {
String group = nacosCrossGroupServiceConfig.getServiceGroupMappings().get(serviceId);
List<Instance> instances = nacosServiceManager.getNamingService().selectInstances(serviceId, group, true);
return hostToServiceInstanceList(instances, serviceId);
}
Expand Down

0 comments on commit f2c4b71

Please sign in to comment.