Hi,

I am looking for a java GRPC server to know if any client (clients are c++
if it matters) connection disconnected abruptly due to network issue. I
learnt from google search that GRPC java have serviceTransportFilter(
https://grpc.github.io/grpc-java/javadoc/io/grpc/ServerTransportFilter.html)
which can be added to ServerBuilder and the functions `transportReady` and `
transportTerminated` are called when client is connected and disconnected.
I added transport filter to my serverbuilder and killed by client program
using `kill -9` but I don't see these method getting triggered. Am i
missing anything? or my understanding about transport filter is wrong?

My serverTransportFilter implementation
public class GRPCServerTransportFilter extends ServerTransportFilter {
private static final Logger LOG = LoggerFactory.getLogger(
GRPCServerTransportFilter.class);

@Override
public Attributes transportReady(final Attributes transportAttrs) {
LOG.info("Client connected {}", transportAttrs.toString());
return transportAttrs;
}

@Override
public void transportTerminated(final Attributes transportAttrs) {
LOG.info("Client disconnected {}", transportAttrs.toString());
}
}


NettyServerBuilder build code
io.grpc.Server server server = NettyServerBuilder.forPort(port)
.permitKeepAliveWithoutCalls(true)
.permitKeepAliveTime(keepAliveTimeOut, TimeUnit.SECONDS)
.addService(new GeyserListenerGRPCService(this::executeHandler,
this::onError, this::onCompleted))
.addTransportFilter(new GRPCServerTransportFilter())
.build();
server.start();

-- 
Thanks,
Sid.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CALguN-FztpnpgTam4u%3D-%3Dn%3DaiUx6jLjP4AsWQqV9MAaPA6%3DJJg%40mail.gmail.com.

Reply via email to