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
5
votes
0 answers

grpc asynchronous bi-directional server (Java/Python)

Here is my scenario. The grpc server is an asynchronous sever which subscribes data from other source. Also it provides a subscribe function to its client, thus it could push the data to the grpc client once it receives data from other source. The…
diaosihuai
  • 151
  • 6
5
votes
1 answer

Grpc Server keeps processing the data even when client get disconnected

I have a server which streams the data for a given request below is the method which does that function @Override public void getChangeFeed(ChangeFeedRequest request, StreamObserver responseObserver) { long queryDate =…
Brajesh Pant
  • 311
  • 1
  • 6
  • 21
5
votes
3 answers

gRPC Java File Download Example

I am looking for a way on how to implement file download functionality using gRPC but I can't find in the documentation how this is done. What is an optimal way to do this? I wanted to have a gRPC server that holds files and a gRPC client to request…
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186
5
votes
1 answer

gRPC: creating Blocking or Future Stubs

Lately, I 'm studying to build the gRPC client-server interaction. I wrote a gRPC service : service SearchService { rpc Find (SearchReq) returns (SearchRes); } and then I should invoke it on the client side using stub(another…
lazarevsky
  • 83
  • 1
  • 7
5
votes
1 answer

gRPC - make a channel to the same server

Let's say I have a gRPC Java service that is hosting a Server. So when a client wants to call this service, they use: ManagedChannel channel = ManagedChannelBuilder .forAddress(grpcHost, grpcPort) .usePlaintext(true) …
Nicholas DiPiazza
  • 10,029
  • 11
  • 83
  • 152
5
votes
2 answers

How can I use nginx 1.9.5 as a reverse proxy with gRPC?

I want to write my backend code with Java, use HTTP/2 (NGINX 1.9.5 has been supported HTTP/2), write a bidirectional stream to send data between client and server at any time. gRPC seems to be the best choice and I want use NGINX as my reverse…
Jacks Gong
  • 694
  • 8
  • 18
5
votes
5 answers

How to pass in json as payload in .proto

As per the following page I should be able to send in json payload : https://developers.google.com/protocol-buffers/docs/proto3 under 'JSON Mapping'. I would like to send in json payload as part of the message and I have the following .proto file…
user1860447
  • 1,316
  • 8
  • 25
  • 46
4
votes
1 answer

@WithSpan not generating logs

I got the metrics and traces pushed to open telemetry collector successfully from my java application with the configuration System.setProperty("otel.resource.attributes", "service.name=OtlpExporterExample"); …
A_G
  • 2,260
  • 3
  • 23
  • 56
4
votes
2 answers

How to handle a nullable enum type field in a protobuf3 message?

The following are my protobuf definitions: enum Foo { BAR = 0; BAZ = 1; } message UpdateRequest { string id = 1; Foo foo = 2; . . . } I need the foo field of the UpdateRequest to be nullable. However, if I don't set the value…
vatsal mevada
  • 5,148
  • 7
  • 39
  • 68
4
votes
0 answers

GRPC io.grpc.StatusRuntimeException: UNAVAILABLE: io exception

The code model looks like as Iterator iterator = grpc.invokeSomeRequest(requestData) //returns iterator while(iterator.hasNext()){ //do some code. } Sometimes the error occurs at iterator.hasNext() with stack trace: UNAVAILABLE: io…
Stanislav Serdiuk
  • 421
  • 1
  • 6
  • 21
4
votes
1 answer

What is the best practice for opening channels on GRPC?

There are services calling service A (10 replicas) via GRpc (100+ req/sec), java generated stubs. We don't have load balancers but I am curios what is the best practice in both cases. Should clients build the channel on each call to service A or…
hevi
  • 2,432
  • 1
  • 32
  • 51
4
votes
1 answer

Returning multiple items in gRPC: repeated List or stream single objects?

gRPC newbie. I have a simple api: Customer getCustomer(int id) List getCustomers() So my proto looks like this: message ListCustomersResponse { repeated Customer customer = 1; } rpc ListCustomers (google.protobuf.Empty) returns…
SledgeHammer
  • 7,338
  • 6
  • 41
  • 86
4
votes
1 answer

gRPC exception related with NameResolverProvider

I have a gRPC server written in Java, that is trying to access Firestore and other services, through a Service Account that has Project Owner roles. The server ran successfully plenty of times, but when I tried to run again, this happened: Exception…
diogojbm
  • 43
  • 1
  • 4
4
votes
1 answer

Java netty/okhttp gRPC client throwing intermittent UNAVAILABLE: io exception while trying to connect

I am trying to connect to go server with java GRPC client (netty and okhttp). But both of them are throwing UNAVAILABLE: io exception intermittently. The occurrence is random and we don't know what's causing this behaviour. We found out that the…
4
votes
1 answer

Maven PluginManagement Variable Binding from Parent POM

Can you help me understand why I cannot put my config on my parent POM? I have this config. When it is in the parent POM, my build fails because the incorrectly resolves…
JJ Zabkar
  • 3,792
  • 7
  • 45
  • 65