55 questions
-1 votes
2 answers
100 views
SendError with tokioi::mpsc::Sender
I try to send a message into a tonic stream, but I get SendError { .. } I do pub struct EventRoute { tx: mpsc::Sender<Result<Message, Status>>, } #[tonic::async_trait] mpl Event for ...
0 votes
2 answers
129 views
Reduced parallelism on first RPC (on blocking code)
Setup I'm playing with tonic helloworld tutorial. The only changes I made is that in say_hello, just before returning the reply, I added: std::thread::sleep(std::time::Duration::from_millis(10000)); ...
1 vote
1 answer
91 views
Cannot return Status type on tonic layer
I follow https://github.com/hyperium/tonic/blob/master/examples/src/tower/server.rs to capture body content of a rpc request before calling logic request. But I get: type mismatch resolving `<...
3 votes
2 answers
314 views
Multiplex axum and tonic on the same listener?
I have axum and tonic running on the same server like the following: let state = AppState { rate_limiter: Arc::new(RateLimiter::new(10, Duration::from_secs(60))), // 10 requests per minute ...
0 votes
1 answer
183 views
service static folder from root without fallback_service
I need to serve a folder created by vitejs. I do pub fn serve_dir() -> Router { let serve_dir = ServeDir::new("web/dist"); Router::new() .route_service("/", ...
0 votes
0 answers
125 views
How to handle error from tower middleware
I would like to return error from tower middleware and tonic. But I don't know how to do that. I tried to return Err, like a Result Returning Ok work I do #[derive(Debug, Clone)] struct MyMiddleware&...
0 votes
1 answer
150 views
Facing issues with the WriteObjectRequest for Google Cloud Storage using gRPC in Rust
I’m trying to perform a simple upload to Google Cloud Storage using gRPC and the generated protos, but I’m running into an issue with the WriteObjectRequest. The error I’m getting is: An x-goog-...
0 votes
1 answer
297 views
applying different layers to different services in one tonic server
I have two versions of a layer, EndpointTimer_1 and EndpointTimer_2 which track slightly different metrics. I want EndpointTimer_1 to be applied to Server_1 and EndpointTimer_2 to applied to Server_2. ...
0 votes
1 answer
392 views
OpenTelemetry span exporter blocks from within tonic RPC
I want to export spans using the OpenTelemetry Protocol from inside of a tonic service. My attempts to do this seemingly result in deadlock. I've created a minimal example here. Here's a summary: I ...
0 votes
2 answers
874 views
Actix-Web + Tonic gRPC proper integration
I have a web server in actix-web and recently I built a different C++ server. I decided to implement gRPC as a communication bridge between the 2. But I don't know how to integrate actix web + tonic (...
2 votes
0 answers
238 views
How do I apply backpressure from the client side (or connection strength) in tonic to avoid consuming the stream too fast?
I have a server-side streaming RPC server and the stream returned by the function is meant to "drop" intermediate updates (in the sense of not returning the from .next()) based on how fast ....
0 votes
0 answers
133 views
Using server-side streaming RPC in tonic, is it safe to do heavy compute without spawn_blocking?
When doing server-side streaming in tonic, the generated async function is expected to return something which implements Stream. If I construct my stream by taking a receiver and then calling .map(...
0 votes
1 answer
1k views
Rust Tonic + Tower: How to apply middleware to specific services only?
I developed middleware using Tower and have been applying it to tonic services via the layer method. However layer applies middleware to all services. I need to apply my middleware to particular ...
1 vote
1 answer
701 views
How to decode tonic-web responses
I'm using tonic-web combined with a React web frontend using @protobuf-ts/grpcweb-transport and @protobuf-ts/plugin. I'm following this tutorial https://www.youtube.com/watch?v=kerKXChDmsE (no need to ...
0 votes
0 answers
273 views
Rust tonic avoiding shared resources
I don't have much experience with Tonic (or Rust) and I'm trying to figure out the correct pattern for setting up a service. Basically, I have the following code: Server::builder() .add_service(...