# discovery-hello

This example documents the Milestone 3 discovery flow.

```rust
use rs_zero::discovery::{
    Discovery, InstanceEndpoint, InstanceSelector, RoundRobinSelector, ServiceInstance,
    StaticDiscovery,
};

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let discovery = StaticDiscovery::new().with_instance(ServiceInstance::new(
    "user-api",
    "user-api-1",
    InstanceEndpoint::new("127.0.0.1", 8080)?,
));

let instances = discovery.discover("user-api").await?;
let selected = RoundRobinSelector::new().select("user-api", &instances)?;
let endpoint = selected.endpoint.authority();
# Ok(())
# }
```

The first adapters are static, in-memory, and DNS based. External registries such as etcd or Kubernetes are enabled through `discovery-etcd` and `discovery-kube` features.
