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
async fn regi_nacos(webConf: &WebServerConfig) { // 请注意!一般情况下,应用下仅需一个 Naming 客户端,而且需要长期持有直至应用停止。 // 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。 let naming_service = NamingServiceBuilder::new( ClientProps::new() .server_addr("127.0.0.1:8848") // Attention! "public" is "", it is recommended to customize the namespace with clear meaning. .namespace("") .app_name("simple_app"), ) .enable_auth_plugin_http() .build();
pub struct ExampleInstanceChangeListener; impl NamingEventListener for ExampleInstanceChangeListener { fn event(&self, event: std::sync::Arc<NamingChangeEvent>) { tracing::info!("subscriber notify event={:?}", event); } } // // example naming subscriber // let subscriber = Arc::new(ExampleInstanceChangeListener); // let _subscribe_ret = naming_service.subscribe( // "test-service".to_string(), // Some(constants::DEFAULT_GROUP.to_string()), // Vec::default(), // subscriber, // ).await; // example naming register instances let service_instance1 = ServiceInstance { ip: "127.0.0.1".to_string(), port: webConf.port.clone() as i32, ..Default::default() }; use nacos_sdk::api::naming::NamingService; //add this import otherwise exception //use unwrap let _register_instance_ret = naming_service.unwrap().batch_register_instance( "test-service".to_string(), Some(constants::DEFAULT_GROUP.to_string()), vec![service_instance1], ).await;
}
The text was updated successfully, but these errors were encountered:
这应该是个小问题?依赖自行引入即可
Sorry, something went wrong.
你的使用中,没有仅一个 naming_service 并保持它,可以参考 examples/lazy_app.rs
naming_service
examples/lazy_app.rs
No branches or pull requests
async fn regi_nacos(webConf: &WebServerConfig) {
// 请注意!一般情况下,应用下仅需一个 Naming 客户端,而且需要长期持有直至应用停止。
// 因为它内部会初始化与服务端的长链接,后续的数据交互及变更订阅,都是实时地通过长链接告知客户端的。
let naming_service = NamingServiceBuilder::new(
ClientProps::new()
.server_addr("127.0.0.1:8848")
// Attention! "public" is "", it is recommended to customize the namespace with clear meaning.
.namespace("")
.app_name("simple_app"),
)
.enable_auth_plugin_http()
.build();
}
The text was updated successfully, but these errors were encountered: