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
16
votes
4 answers

How to use mockito to mock grpc ServiceBlockingStub to throw StatusRuntimeException(Status.UNAVAILABLE)?

I want to mock my grpc client to ensure that it is resilient to failure by throwing an new StatusRuntimeException(Status.UNAVAILABLE) (This is the exception that is thrown when java.net.ConnectException: Connection refused is thrown to the grpc…
joseph
  • 2,429
  • 1
  • 22
  • 43
16
votes
2 answers

Organization of protobuf files in a microservice architecture

In my company, we have a system organized with microservices with a dedicated git repository per service. We would like to introduce gRPC and we were wondering how to share protobuf files and build libs for our various languages. Based on some…
antham
  • 408
  • 4
  • 15
16
votes
4 answers

How to generate python class files from protobuf

I am trying to transfer large amounts of structured data from Java to Python. That includes many objects that are related to each other in some form or another. When I receive them in my Python code, it's quiet ugly to work with the types that are…
pascalwhoop
  • 2,984
  • 3
  • 26
  • 40
16
votes
1 answer

Should I share gRPC Stubs or Channels?

The gRPC C++ API for creating channels returns a shared_ptr. The generated function NewStub returns a unique_ptr. However I've seen reports of people having issues trying to create multiple instances of a stub type, sharing a channel. Their solution…
Ken
  • 693
  • 1
  • 7
  • 15
16
votes
1 answer

What is the difference between dynamically and statically generated grpc code?

In the examples of the GRPC client there are two types of implementation, one where the .proto files are loaded and processed at runtime, and one where they are compiled using protoc. My question is: what is the difference? The docs say nothing…
Sander
  • 1,183
  • 12
  • 27
15
votes
3 answers

Using gRPC and/or GraphQL for microservice architecture

At my company we're about to set up a new microservice architecture, but we're still trying to decide which protocol would be best for our use case. In our case we have some services that are called internally by other services, but are also exposed…
Duncan Lukkenaer
  • 12,050
  • 13
  • 64
  • 97
15
votes
1 answer

gRPC connection: use keepAlive or idleTimeout?

Looking at gRPC Java doc - ManagedChannelBuilder, there're two options to manage the connections. It seems idleTimeout() is the default/preferred configuration. But when I tried to search for a comparison, most of the posts are talking about…
xialin
  • 7,686
  • 9
  • 35
  • 66
15
votes
1 answer

How to point webpack to a specific node_modules folder

I am trying to build a grpc web client and I need to pack the code to resolve the require statements. I have compiled the protos to js and it works if I have them in the current folder where I have installed the node modules. The problem is if I…
codentary
  • 993
  • 1
  • 14
  • 33
15
votes
6 answers

How to fix "Could not find policy 'pick_first'" with Google TTS java client?

I can't make a request using Google TTS Client library in java. Each time it throws a bunch of exceptions. I just try to get a list of available voices. GoogleCredentials creds = null; TextToSpeechClient textToSpeechClient = null; try…
Gui-Yôm
  • 165
  • 1
  • 8
15
votes
4 answers

How to cross compile a rust project with openssl?

My project is written in Rust (Ubuntu 16.04, CMake 3.5.1). Previously it used grpcio = "0.4.0" as a dependency in Cargo.toml and I could successfully cross-compile (i.e., create a static binary) it (using cross). However, after I changed my…
James Larkin
  • 541
  • 5
  • 18
15
votes
1 answer

How can a gRPC server notice that the client has cancelled a server-side streaming call?

I want to use gRPC to let clients subscribe to events generated by the server. I have an RPC declared like so: rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse); where the returned stream is infinite. To "unsubscribe", clients…
Balz Guenat
  • 1,552
  • 2
  • 15
  • 35
15
votes
3 answers

How to use the gRPC tools to generate code

I've read the tutorial and I'm able to generate the .cs file but it doesn't include any of my service or rpc definitions. I've added protoc to my PATH and from inside the project directory. protoc project1.proto --csharp_out="C:\output"…
user3953989
  • 1,844
  • 3
  • 25
  • 56
15
votes
1 answer

Does the grpc server use one new goroutine to process one method call?

How does golang grpc implementation handle the server concurrency? One goroutine per method call? Or sort of goroutine pool? Does it depend on the concurrency model of net/http2?
kingluo
  • 1,679
  • 1
  • 13
  • 31
15
votes
1 answer

How to parse HTTP message from another node to a gRPC server

I could successfully run a gRPC client and gRPC server in c++ now I wish to establish a communication between node A and gRPC server i.e. node B as in the attached image. Are there any examples which I can refer to below is what I am looking for. I…
Vinay Shukla
  • 1,818
  • 13
  • 41
15
votes
2 answers

Keep Dotnet Core Grpc Server running as a console application?

I am trying to keep a Grpc server running as a console daemon. This gRPC server is a microservice that runs in a docker container. All of the examples I can find make use of the following: Console.ReadKey(); This does indeed block the main thread…
Mitch Dart
  • 1,333
  • 1
  • 12
  • 33