[gRPC Java] : Long time async Server streaming RPCs

565 views
Skip to first unread message

deepakag...@gmail.com

unread,
May 16, 2017, 6:28:46 AM5/16/17
to grpc.io

Hi All,
   This is Deepak here, i have been reading about gRPC from last couple of weeks, I want to use gRPC in one of my solution.

But as a beginner in gRPC i have several doubts about it. My scenarios are (both needs to be supported together at same time in same application)

1) My application is a gRPC client, which invokes server-side streaming RPC. (there can be multiple RPC calls and all rpcs need to be kept alive for relatively long time)
    rpc subscribe(argument) returns (stream message) {};

2) My Application is a gRPC server which provides a bi-directional streaming RPC and will be used by other application to push notifications to my applications
   rpc notify(stream message) returns(stream message)



My doubts are 
For Scenario 1: 
a) Can I have a non blocking implementation in java where my threads are not waiting for the server stream and the RPCs are kept alive untill i cancel it.
b) Can both the scenarios exist in the same application at a same time??

Thanks ,
Deepak

Eric Anderson

unread,
May 16, 2017, 7:55:30 PM5/16/17
to deepakag...@gmail.com, grpc.io
In both scenarios you are covered. Do recognize that streams will eventually die, so you should plan on reconnecting them. But they can last for a long time. Depending on your network, you may also want to enable keepalive via NettyChannelBuilder.keepAliveTime. You'll want to use the async stub API. gRPC will still use a thread, but it can share the thread across all the streams.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/631a750b-4397-4842-a3e7-8bf9f8b2f959%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages