I am using gRPC and I need to get the name of the service of the request from the ServerInterceptor but it seems it is not possible.
Basically from an implementation of ServerInterceptor I need to know the name of the ServiceGrpc (as a string) that will be invoked.
public class PermissionInterceptor implements ServerInterceptor {
@Override
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
ServerCall<ReqT, RespT> serverCall, Metadata metadata, ServerCallHandler<ReqT, RespT> handler
) {
// here I need the name of RPC service that has been requested
return handler.startCall(serverCall, metadata);
}
}
Please note that I have tried with serverCall.getMethodDescriptor() but it returns the name of the proto service rather than the real name of the (java) service.
It returns:
co.test.domain.transaction.TransactionService
But I need this:
co.test.domain.transaction.TransactionNeoBasicImpl
Thanks