Package com.linecorp.armeria.server.grpc
Interface AsyncServerInterceptor
- All Superinterfaces:
ServerInterceptor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A
ServerInterceptor
that is able to asynchronously execute the interceptor without blocking the
caller thread.
For example:
class AuthServerInterceptor implements AsyncServerInterceptor {
@Override
<I, O> CompletableFuture<Listener<I>> asyncInterceptCall(
ServerCall<I, O> call, Metadata headers, ServerCallHandler<I, O> next) {
return authorizer.authorize(headers).thenApply(result -> {
if (result) {
return next.startCall(call, headers);
} else {
throw new AuthenticationException("Invalid access");
}
});
}
}
-
Method Summary
Modifier and TypeMethodDescription<I,
O> CompletableFuture<ServerCall.Listener<I>> asyncInterceptCall
(ServerCall<I, O> call, Metadata headers, ServerCallHandler<I, O> next) default <I,
O> ServerCall.Listener<I> interceptCall
(ServerCall<I, O> call, Metadata headers, ServerCallHandler<I, O> next)
-
Method Details
-
asyncInterceptCall
<I,O> CompletableFuture<ServerCall.Listener<I>> asyncInterceptCall(ServerCall<I, O> call, Metadata headers, ServerCallHandler<I, O> next) -
interceptCall
default <I,O> ServerCall.Listener<I> interceptCall(ServerCall<I, O> call, Metadata headers, ServerCallHandler<I, O> next) - Specified by:
interceptCall
in interfaceServerInterceptor
-