All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.grpc.runtime.supports.exc.ExceptionInterceptor Maven / Gradle / Ivy

There is a newer version: 3.15.1
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy