Hi Eric,

Thanks for your idea. Here is how I have implemented it, tell me if this is 
correct:

rpc HeartBeat(stream Void) returns Void;

C# Client do:
using (var heartBeat = client.HeartBeat(new CallOptions(null, null, channel.
ShutdownToken).WithWaitForReady(true)))
{
    await heartBeat.ResponseAsync;
}



On Java server side:

  
  @Override
  public StreamObserver<Void> heartBeat(StreamObserver<Void> 
responseObserver) {
    return new StreamObserver<Void>() {

      @Override
      public void onNext(Void value) {
        // Nothing to do
      }

      @Override
      public void onError(Throwable t) {
        shutdown();
      }

      @Override
      public void onCompleted() {
        shutdown();
      }
    };
  }


Does it seems correct for you? Why would have to enable keepalive?

Thanks,

Julien

Le mercredi 12 juillet 2017 01:43:14 UTC+2, Eric Anderson a écrit :
>
> On Mon, Jul 10, 2017 at 6:03 AM, <[email protected] <javascript:>> 
> wrote:
>
>> We are using grpc for C# <-> Java integration. The C# client application 
>> will start the Java process containing the grpc server, and then create a 
>> Chanel used for calling methods on Java server side.
>>
>> One problem we have is to properly terminate the Java server in case the 
>> C# client crashed badly. In the current state, the Java process keeps 
>> running in the background forever.
>>
>> Is there a way to be notified on server side when a client died?
>>
>
> I'd suggest the C# client creates a long-running RPC to the Java server, 
> and the RPC will be seen as cancelled on the server when the connection is 
> broken. I don't believe you need it in your case, but in similar cases 
> you'd want to enable keepalive 
> <https://grpc.io/grpc-java/javadoc/io/grpc/netty/NettyServerBuilder.html#keepAliveTime-long-java.util.concurrent.TimeUnit->
>  
> on the server-side.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/efd11cd7-f494-4445-b008-bb6aa14b0adc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to