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的问题 #1390

Open
suqinglee opened this issue Oct 21, 2024 · 9 comments
Open

反馈一个nacos的问题 #1390

suqinglee opened this issue Oct 21, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@suqinglee
Copy link

版本:1.18.0
客户端版本:com.alibaba.nacos/nacos-client/2.1.0
客户端代码:

package com.su;

import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.config.listener.Listener;
import com.alibaba.nacos.api.exception.NacosException;

import java.util.Properties;
import java.util.concurrent.Executor;

public class Main {
    public static void main(String[] args) throws NacosException {

        try {
            Properties properties = new Properties();
            properties.put("serverAddr", "127.0.0.1:8848");

            ConfigService configService = NacosFactory.createConfigService(properties);

            String dataId = "hello.text";
            String group = "test";
            String content = configService.getConfig(dataId, group, 5000);
            System.out.println("配置内容:" + content);

            Listener listener = new Listener() {
                @Override
                public void receiveConfigInfo(String configInfo) {
                    System.out.println("配置变更:" + configInfo);
                }
                @Override
                public Executor getExecutor() {
                    return null;
                }
            };

             // 添加配置监听
            configService.addListener(dataId, group, listener);

            // 发布配置
            String newContent = "test";
            configService.publishConfig(dataId, group, newContent);

            newContent = "test again";
            configService.publishConfig(dataId, group, newContent);


            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        } catch (NacosException e) {
            e.printStackTrace();
        }
    }
}

代码输出:
image

问题:偶现配置变更:null这样的输出结果

@suqinglee suqinglee added the bug Something isn't working label Oct 21, 2024
@suqinglee
Copy link
Author

suqinglee commented Oct 21, 2024

还有一个问题是,我这个通过客户端发布的配置文件,在控制台编辑的时候会报这样的错误,原因应该是自动加了没有value的key导致的报错,去掉encryptedDataKey这个标签就正常了。
image

@suqinglee
Copy link
Author

顺便问下,我看腾讯云TSE有了买开源版nacos的渠道,请问贵团队后续还会维护开源版polaris的nacos协议么?

@chuntaojun
Copy link
Member

会持续维护,这个问题我看下

@chuntaojun chuntaojun self-assigned this Oct 22, 2024
@chuntaojun
Copy link
Member

@suqinglee 问题一,null的问题,nacos-client 直接连接 nacos-server 没有这个问题是吗

@suqinglee
Copy link
Author

@suqinglee 问题一,null的问题,nacos-client 直接连接 nacos-server 没有这个问题是吗

是的

@suqinglee
Copy link
Author

还有一个,配置灰度发布后,停止灰度,nacos client收不到配置变更的事件,开源nacos是可以的;以及问下现在是不支持nacos基于标签灰度发布么?

@chuntaojun
Copy link
Member

nacos 目前只支持 ip 的灰度发布,你的配置灰度发布信息可以截图看一下嘛

@suqinglee
Copy link
Author

image

@chuntaojun 这样的,灰度发布可以收到,停止灰度的话收不到
image

@suqinglee
Copy link
Author

骚瑞,收到了,不过延迟比较高,我差不多收到第一次配置变更就去点停止发布了 @chuntaojun
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants