Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nacos-discovery-spring-boot-starter 中命名空间配置失效 #11

Closed
jonerxq opened this issue Feb 15, 2019 · 3 comments
Closed

nacos-discovery-spring-boot-starter 中命名空间配置失效 #11

jonerxq opened this issue Feb 15, 2019 · 3 comments

Comments

@jonerxq
Copy link

jonerxq commented Feb 15, 2019

nacos:
config:
server-addr: 127.0.0.1:8848
namespace: 67cea0fe-daef-48fe-a9c6-488aee2f4f74
discovery:
server-addr: 127.0.0.1:8848
namespace: 67cea0fe-daef-48fe-a9c6-488aee2f4f74
发现 注册后是 Public 的命名空间
image

查看源码发现与api 的 说明不符合
public void registerService(String serviceName, Instance instance) throws NacosException {

    LogUtils.LOG.info("REGISTER-SERVICE", "registering service " + serviceName + " with instance:" + instance);

    final Map<String, String> params = new HashMap<String, String>(8);
    params.put("tenant", namespace);   要替换成namespaceId
    params.put("ip", instance.getIp());
    params.put("port", String.valueOf(instance.getPort()));
    params.put("weight", String.valueOf(instance.getWeight()));
    params.put("healthy", String.valueOf(instance.isHealthy()));
    params.put("metadata", JSON.toJSONString(instance.getMetadata()));
    if (instance.getService() == null) {
        params.put("serviceName", serviceName);
    } else {
        params.put("service", JSON.toJSONString(instance.getService()));
    }
    params.put("cluster", JSON.toJSONString(instance.getCluster()));

    reqAPI(UtilAndComs.NACOS_URL_INSTANCE, params, "PUT");
}
@fangjian0423
Copy link
Collaborator

Naming service support namespace is support in nacos 0.8.0.

We will upgrade nacos-spring version to support it.

@chuntaojun
Copy link
Member

already fix,Wait for me to raise pr

@chuntaojun
Copy link
Member

#31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants