Questions tagged [grpc-java]

Java version of general RPC (Remote Procedure Call) framework over HTTP/2.

Links

What is gRPC?

In gRPC a client application can directly call methods on a server application on a different machine as if it was a local object, making it easier for you to create distributed applications and services. As in many RPC systems, gRPC is based around the idea of defining a service, specifying the methods that can be called remotely with their parameters and return types. On the server side, the server implements this interface and runs a gRPC server to handle client calls. On the client side, the client has a stub (referred to as just client in some languages) that provides the same methods as the server.

By default gRPC uses protocol buffers, Google’s mature open source mechanism for serializing structured data (although it can be used with other data formats such as JSON). As you’ll see in our example below, you define gRPC services using proto files, with method parameters and return types specified as protocol buffer message types. You can find out lots more about protocol buffers in the Protocol Buffers documentation.

863 questions
8
votes
4 answers

How to create GRPC client directly from protobuf without compiling it into java code

When working with gRPC, we need to generate the gRPC client and server interfaces from our .proto service definition via protocol buffer compiler (protoc) or using Gradle or Maven protoc build plugin. Flow now: protobuf file -> java code -> gRPC…
mtSiniChi
  • 81
  • 2
  • 6
8
votes
1 answer

--grpc_out: protoc-gen-grpc: Plugin failed with status code 1 on osx. (Java)

I am following a tutorial about using grpc and I am supposed to use a plugin to generate source code but I am stuck on how to use the --grpc_out and --plugin flag. Below are the current challenges. The protocol generator downloaded from…
IsaacK
  • 1,178
  • 1
  • 19
  • 49
8
votes
2 answers

is it possible to use jmeter to test grpc

Was wondering if anybody has tried to use jmeter to test gRPC application. I was hoping that I could write a gRPC client class with a non-blocking/asynchronous stub that makes non-blocking calls to the server, Create a Jar of the above client…
Alok A
  • 233
  • 1
  • 3
  • 9
8
votes
2 answers

Exception handling in gRPC

I have a server written in Java and client written in PHP. How can client catch exception from server if anything goes wrong? I can't find anything about exception handling in gRPC documentation. Thank you!
Kevin
  • 1,403
  • 4
  • 18
  • 34
7
votes
1 answer

How to cancel a GRPC streaming call?

Usually, the client can cancel the gRPC call with: (requestObserver as ClientCallStreamObserver) .cancel("Cancelled", null) However, it is shown in the Javadoc: CancellableContext withCancellation =…
Abhijit Sarkar
  • 21,927
  • 20
  • 110
  • 219
7
votes
1 answer

grpc-java: Proper handling of retry on client for service streaming call

I'm trying to setup a simple pubslish/subscribe pattern over grpc using service streaming together with async stub on client. After implementing part of streaming messages back to client, I wanted to handle scenarios for connection drops. Right now…
7
votes
4 answers

Spring Boot gRPC: How to return error code when business error happens?

I am implementing a gRPC API using LogNet grpc-spring-boot-starter. I want to return, for instance, an INVALID_ARGUMENT error code when an incorrect argument has been passed. If I throw a custom exception it ends up with…
Sasha Shpota
  • 9,436
  • 14
  • 75
  • 148
7
votes
3 answers

Failed to load any of the given libraries: [netty-tcnative-linux-x86_64,netty-tcnative]

I have deployed a web-application inside a tomcat container and have used grpc-netty (1.2.0) with netty-tcnative-boringssl-static:jar:1.1.33.Fork26. When i switch on debug logs it tells that "java.lang.IllegalArgumentException: Failed to load any of…
Ajay
  • 242
  • 1
  • 3
  • 13
7
votes
2 answers

Do I need to pool ManagedChannel instances for a multithreaded Java GRPC (1.1.2) client?

TL;DR Does grpc-java's ManagedChannel have an implicit connection pool or is the pooling of ManagedChannel instances the responsibility of the user? So, I am using java grpc 1.1.2 with protoc 3.2.0. It seems to me that there's no implicit support…
gravetii
  • 9,273
  • 9
  • 56
  • 75
7
votes
1 answer

Bind gRPC service to localhost in Java

I have a gRPC service which I would just like to bind just to the localhost address. However, I don't see a way to do that in Java. Instead it will bind to all addresses. Here is how I create my service now: server =…
Dusty Campbell
  • 3,146
  • 31
  • 34
6
votes
1 answer

Is it possible to use gRPC protobuf along with Spring webflux?

I am new to Spring webflux as well as protobuf. I have been reading some stuff and I have found some similarities between them. Like Spring webflux could be deployed over netty so does gRPC. Both work good for streaming data. Both these frameworks…
Ady
  • 584
  • 8
  • 16
6
votes
2 answers

Rejecting mutual TLS gRPC connection based on RSA public key size

I have a gRPC server which is using mutual TLS for encryption and authentication. So, every client that connects to this server provides an SSL certificate and I want to reject connections from clients who have a public key size less than 2048 bits.…
Aditya Vikas Devarapalli
  • 3,186
  • 2
  • 36
  • 54
6
votes
1 answer

How does one generate client and server code manually for Java in gRPC?

The official documentation states the following with respect to generating client and server code. Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler…
merlin2011
  • 71,677
  • 44
  • 195
  • 329
6
votes
0 answers

how to avoid gRPC async server streaming missing messages on start?

I've implemented an async server stream of messages and I have tests that call the rpc, then cause a message to be sent from the server, and then wait for the onNext(). Sometimes the tests fail because the rpc call arrives to the server after I…
Maxim Y
  • 339
  • 1
  • 6
6
votes
2 answers

protoc command not generating all base classes (java)

I have been trying to generate the basic gRPC client and server interfaces from a .proto service definition here from the grpc official repo. The relevant service defined in that file (from the link above) is below: service RouteGuide { rpc…
shafeen
  • 2,431
  • 18
  • 23
1 2
3
57 58