ez-rust-discovery

Crates.ioez-rust-discovery
lib.rsez-rust-discovery
version0.1.2
created_at2025-11-26 07:40:54.898228+00
updated_at2025-11-27 06:48:46.242227+00
descriptiongRPC service discovery through Nacos
homepagehttps://github.com/zlx2019/ez-rust-discovery
repositoryhttps://github.com/zlx2019/ez-rust-discovery
max_upload_size
id1951082
size57,918
Zero (zlx2019)

documentation

https://github.com/zlx2019/ez-rust-discovery/README.md

README

Install

cargo add ez-rust-discovery

Usage Example

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // TODO Start gRPC or HTTP service.

    let manager = ServiceManager::new(ServeOptions::default())?;
    if let Err(e) = manager.online() {
        println!("online fail, caused by: {}", e);
        std::process::exit(1);
    };

    std::thread::sleep(std::time::Duration::from_secs(30));
    // TODO block Listen signal...

    // Go offline before the gRPC or HTTP service shuts down
    manager.offline()?;

    // TODO Close gRPC or HTTP service.
    Ok(())
}

Environment

Name Description Default value
NACOS_ADDR Nacos server address
NACOS_NAMESPACE Service namespace public
SERVICE_ADDR Service address
SERVICE_NAME Service name
Commit count: 0

cargo fmt