use std::time::Duration;
use ginepro::LoadBalancedChannel;
use anyhow::Context;
use shared_proto::pb::{echo_client::EchoClient, EchoRequest};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel = LoadBalancedChannel::builder(("localhost", 5000_u16))
.resolution_strategy(ginepro::ResolutionStrategy::Eager {
timeout: Duration::from_secs(20),
})
.channel()
.await
.context("failed to build LoadBalancedChannel")?;
let mut client = EchoClient::new(channel);
let request = tonic::Request::new(EchoRequest {
message: "hello".into(),
});
let response = client.unary_echo(request).await?;
println!("RESPONSE={response:?}");
Ok(())
}