Hi Sanjay,

Yes. my requirement is that I need my server to know about a client
connection init/termination status. Do we have any other way to accomplish
this? Please note, I need client address when it disconnects.

I will try once again if transportReady() is called after RPC call is
started.

On Fri, Aug 20, 2021 at 2:30 PM '[email protected]' via grpc.io <
[email protected]> wrote:

> Do you see the callback `transportReady()` being called? Pls make sure
> `transportReady()` is called. Because of lazy init the connection may not
> even have been created unless you sent RPCs
>
> Also what's your use case that you need to know about a client connection
> init/termination status?
>
> On Thursday, August 19, 2021 at 12:57:26 AM UTC-7 [email protected]
> wrote:
>
>> 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/a741f7c7-1c8c-4925-8a37-fdcc48c4ef4cn%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/a741f7c7-1c8c-4925-8a37-fdcc48c4ef4cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks,
Sidhartha Thota.

-- 
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-FWK5uvAMPgr%2BeXMNMD7oPZdZpK5xWLJMmBcVO3%2BgW7og%40mail.gmail.com.

Reply via email to