Package io.grpc
Interface ServerInterceptor
-
- All Known Implementing Classes:
OrcaMetricReportingServerInterceptor
,TransmitStatusRuntimeExceptionInterceptor
@ThreadSafe public interface ServerInterceptor
Interface for intercepting incoming calls before they are dispatched byServerCallHandler
.Implementers use this mechanism to add cross-cutting behavior to server-side calls. Common example of such behavior include:
- Enforcing valid authentication credentials
- Logging and monitoring call behavior
- Delegating calls to other servers
The interceptor may be called for multiple
calls
by one or more threads without completing the previous ones first. Refer to theServerCall.Listener
docs for more details regarding thread safety of the returned listener.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <ReqT,RespT>
ServerCall.Listener<ReqT>interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
-
-
-
Method Detail
-
interceptCall
<ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
InterceptServerCall
dispatch by thenext
ServerCallHandler
. General semantics ofServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
apply and the returnedServerCall.Listener
must not benull
.If the implementation throws an exception,
call
will be closed with an error. Implementations must not throw an exception if they started processing that may usecall
on another thread.- Parameters:
call
- object to receive response messagesheaders
- which can contain extra call metadata fromClientCall.start(io.grpc.ClientCall.Listener<RespT>, io.grpc.Metadata)
, e.g. authentication credentials.next
- next processor in the interceptor chain- Returns:
- listener for processing incoming messages for
call
, nevernull
.
-
-