io.quarkus.grpc.runtime.supports.exc.ExceptionInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-grpc Show documentation
Show all versions of quarkus-grpc Show documentation
Serve and consume gRPC services
package io.quarkus.grpc.runtime.supports.exc;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.spi.Prioritized;
import jakarta.inject.Inject;
import io.grpc.Metadata;
import io.grpc.ServerCall;
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
import io.quarkus.grpc.ExceptionHandlerProvider;
import io.quarkus.grpc.GlobalInterceptor;
import io.quarkus.grpc.runtime.Interceptors;
@ApplicationScoped
@GlobalInterceptor
public class ExceptionInterceptor implements ServerInterceptor, Prioritized {
@Inject
ExceptionHandlerProvider provider;
@Override
public ServerCall.Listener interceptCall(
ServerCall call,
Metadata headers,
ServerCallHandler next) {
return provider.createHandler(next.startCall(call, headers), call, headers);
}
@Override
public int getPriority() {
return Interceptors.EXCEPTION_HANDLER;
}
}