Questions tagged [grpc]

A general RPC (Remote Procedure Call) framework over HTTP/2, initially developed at Google. gRPC is a language neutral and platform neutral framework that allows users to write applications where independent services can work with each other as if they were native. It uses Protocol Buffers as the interface description language.

Links

Related Tags

6316 questions
15
votes
3 answers

How to write a GRPC python unittest

We are using grpc as the RPC protocol for all our internal system. Most of the system is written in Java. In Java, we can use InprocessServerBuilder for unittest. However, I haven't find a similar class in Python. Can any one provide a sample code…
Crazymooner
  • 231
  • 1
  • 3
  • 11
15
votes
4 answers

Import timestamp in proto file of protobuf for GRPC

I am trying to use gRPC and using the exchange message format as protobuf. I wanted to add timestamp field inside my message.But i don't know the right way to add the import statement in proto file. I am using Golang so I need an output as .pb.go
Rajesh kumar
  • 332
  • 3
  • 4
  • 12
15
votes
3 answers

How do you set a timeout in Python's gRPC Library

I have a grpc server / client that today will occasionally hang, causing issues. This is being called from a Flask application which is checking in with a background worker process to make sure it's alive / functioning. To make the request to the…
kkirsche
  • 1,217
  • 2
  • 15
  • 38
15
votes
1 answer

What is the purpose of the brackets {} after a gRPC method definition?

In gRPC you can define a method like service HelloService { rpc SayHello (HelloRequest) returns (HelloResponse); } or service HelloService { rpc SayHello (HelloRequest) returns (HelloResponse) {} } (from…
Dmitry Minkovsky
  • 36,185
  • 26
  • 116
  • 160
15
votes
2 answers

how to read metadata in grpc on the server side? (golang example)

How to read metadata (passed as a header) on the server side in grpc? Any example in golang? I am writing something like this: // this should be passed from the client side as a context and needs to accessed on server side to read the metadata var…
Sanket
  • 331
  • 1
  • 4
  • 8
15
votes
3 answers

How to implement a async grpc python server?

I need to call a celery task for each GRPC request, and return the result. In default GRPC implementation, each request is processed in a separate thread from a threadpool. In my case, the server is supposed to process ~400 requests in batch mode…
xun changqing
  • 163
  • 1
  • 1
  • 7
14
votes
2 answers

Correct way to perform a reconnect with gRPC client

I have a Go gRPC client connected to a gRPC server running in a different pod in my k8s cluster. It's working well, receiving and processing requests. I am now wondering how best to implement resiliency in the event that the gRPC server pod gets…
Fin
  • 311
  • 1
  • 2
  • 9
14
votes
5 answers

Import "google/api/annotations.proto" was not found or had errors. How do I add it as a dependency?

Following the docs on how to set up a gRPC gateway, I find myself stuck at step four of generating the grpc gateway. Namely, things fall apart when the following line is added: import "google/api/annotations.proto"; The documentation says You will…
cbll
  • 6,499
  • 26
  • 74
  • 117
14
votes
4 answers

gRPC: 14 UNAVAILABLE: failed to connect to all addresses

grpc fails to connect even when I set my jest test() async function to a 100000ms cap before it times out. // terminal, after running jest --watch ● creates new record 14 UNAVAILABLE: failed to connect to all addresses at…
Sean D
  • 3,810
  • 11
  • 45
  • 90
14
votes
4 answers

Is it possible to use gRPC with HTTP/1.1 in .NET Core?

I have two network services - a gRPC client and gRPC server. Server is written in .NET Core, hence HTTP/2 for gRPC is enforced. Client however is a .NET Framework 4.7.2 web app hosted on IIS 8.5, so it only supports HTTP/1.1. Since it will take some…
GrayCat
  • 1,749
  • 3
  • 19
  • 30
14
votes
2 answers

Can I combine a gRPC and webapi app into a .NET Core 3.0 in C#?

I am using dot net core 3.0. I have gRPC app. I am able to communicate to it through gRPC protocol. I thought my next step would be add some restful API support. I modified my startup class to add controllers, routing etc..... When I try navigating…
14
votes
1 answer

How to read async server side streaming using GRPC c++

I am trying to implement asynchronous server-side streaming using C++. but I am not able to find any good example for the same. I am having a hard time reading stream asynchronously. Server Code class ServerImpl final { public: ~ServerImpl() …
laxmi
  • 141
  • 1
  • 4
14
votes
1 answer

What is the difference between metadata.FromOutgoingContext and metadata.FromIncomingContext?

If you are in a middle-ware that both receives the context and maybe append some data to context to send it to the next interceptor, then which of the two methods i.e. metadata.FromOutgoingContext and metadata.FromIncomingContext shall be called?
Javad M. Amiri
  • 594
  • 5
  • 20
14
votes
1 answer

gRPC Python thread_pool vs max_concurrent_rpcs

When launching a Python grpc.server, what's the difference between maximum_concurrent_rpcs and the max_workers used in the thread pool. If I want maximum_concurrent_rpcs=1, should I still provide more than one thread to the thread pool? In other…
David Adrian
  • 1,079
  • 2
  • 9
  • 24
14
votes
1 answer

Python protobuf gRPC generates a dependency that doesn't exist

I'm trying to create a gRPC binding for my python code via: python -m grpc_tools.protoc -I $(pwd)/protos --python_out=./fino/pb2 --grpc_python_out=./fino/pb2 -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf $(pwd)/protos/* But the…
nmiculinic
  • 2,224
  • 3
  • 24
  • 39