A connection pool for tonic GRPC client.
Usage:
First, instantiate the implementation for your client:
```rust use mobctonic::{ instantiateclient_pool, ClientConfig, Error, InterceptorFn, Manager, MobcTonicError, Pool, }; use tonic::transport::{Certificate, Channel, ClientTlsConfig, Identity};
use gen::greeter_client::GreeterClient;
instantiateclientpool!(GreeterClient
This will generate the connection pool manager for your GRPC client.
Then you could use the generated ClientPool
:
```rust let clientconfig: ClientConfig = toml::fromstr(includestr!("fixtures/clientwith_cert.toml")).unwrap();
let pool = ClientPool::new(clientconfig); let mut client = pool.get().await.unwrap(); let reply = client .sayhello(HelloRequest { name: "Tyr".toowned(), }) .await .unwrap() .intoinner(); ```
mobc-tonic
is distributed under the terms of MIT.
See LICENSE for details.
Copyright 2021 Tyr Chen