We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
额,解决了:配置项 SUBSCRIPTION_POLL_INTERVAL 未设置
麻烦问一下, 使用该sdk向nacos服务进行注册的时候,首次注册的回调为什么要等大概5秒左右才能收到回调,以下是注册和接收回调的代码:
nacos::Properties conf; conf[nacos::PropertyKeyConst::SERVER_ADDR] = m_strNacosAddressList; conf[nacos::PropertyKeyConst::UDP_RECEIVER_PORT] = std::to_string(m_nLocalPort); try { auto factory = nacos::NacosFactoryFactory::getNacosFactory(conf); nacos::ResourceGuard<nacos::INacosServiceFactory> _guardFactory(factory); m_pNacosNamingService = factory->CreateNamingService(); } catch (const nacos::NacosException &e) { logW("initialization of nacos naming service failed: " + std::string(e.what())); return false; } // setup nacos instance params. nacos::Instance instance; instance.ip = m_strLocalIP; instance.port = m_nLocalPort; instance.clusterName = "test"; instance.instanceId = "xxxxxxxxxxxxxx"; instance.ephemeral = true; // regist and subscribe. try { m_pNacosNamingService->registerInstance(strServiceName, instance); if (!m_bIsNacosSubscribed) { m_bIsNacosSubscribed = true; m_pNacosNamingService->subscribe(strServiceName, new NacosEventListener(this)); } } catch (const nacos::NacosException &e) { logW("registration failed: " + std::string(e.what())); return false; } return true;
class NacosEventListener : public nacos::EventListener {
public: NacosEventListener(CCallback*pCallback) { this->m_pCallback= pCallback; }
public: void receiveNamingInfo(const nacos::ServiceInfo &serviceInfo) { m_pCallback->OnNacosReceiveNamingInfo(serviceInfo); }
private: CCallback* m_pCallback;
};
The text was updated successfully, but these errors were encountered:
No branches or pull requests
额,解决了:配置项 SUBSCRIPTION_POLL_INTERVAL 未设置
麻烦问一下, 使用该sdk向nacos服务进行注册的时候,首次注册的回调为什么要等大概5秒左右才能收到回调,以下是注册和接收回调的代码:
class NacosEventListener : public nacos::EventListener {
public:
NacosEventListener(CCallback*pCallback) {
this->m_pCallback= pCallback;
}
public:
void receiveNamingInfo(const nacos::ServiceInfo &serviceInfo) {
m_pCallback->OnNacosReceiveNamingInfo(serviceInfo);
}
private:
CCallback* m_pCallback;
};
The text was updated successfully, but these errors were encountered: