Crates.io | clia-nacos-api |
lib.rs | clia-nacos-api |
version | 0.2.2 |
source | src |
created_at | 2022-04-02 08:45:29.986617 |
updated_at | 2022-04-02 08:45:29.986617 |
description | A personal temporary Nacos API, forked from Squbirreland/nacos-api. |
homepage | |
repository | https://github.com/clia/clia-nacos-api |
max_upload_size | |
id | 560754 |
size | 82,791 |
A personal temporary Nacos API, forked from Squbirreland/nacos-api.
use nacos_api::{NacosClient, NacosConfig, ServerConfig};
#[tokio::main]
async fn main() {
let nacos = NacosConfig::new("http", "192.168.0.132", 8848);
let client = NacosClient::new(
&nacos,
ServerConfig::new("127.0.0.1", 8080, "test"),
);
client.register(&None).await;
loop {}
}
pub async fn try_req_server() {
use nacos_api::{NacosClient, NacosConfig, ServerConfig};
let nacos = NacosConfig::new("http", "192.168.0.132", 8848);
let client = NacosClient::new(
&nacos,
ServerConfig::new("127.0.0.1", 8080, "test"),
);
let addr = client.get_addr_simple("test").await?;
assert!("http://127.0.0.1:8080", addr.as_str());
}
use nacos_api::{NacosConfigClient, NacosConfigApi, DeployConfig, NacosConfig};
#[tokio::main]
async fn main() {
let client = NacosConfigClient::new("test_data", "test_grep", None);
let nacos_config = NacosConfig::new("http", "192.168.0.132", 8848);
// listen the nacos configs center
client.listen_config(
&nacos_config,
|s| { println!(" perceive the configs changed to > {}", s) },
10
).await;
// make the program keep alive
loop {}
}
development by nacos v2.0.1