io.quarkus.grpc.runtime.supports.CompressionInterceptor 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;
import io.grpc.Metadata;
import io.grpc.ServerCall;
import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
public class CompressionInterceptor implements ServerInterceptor {
private final String compression;
public CompressionInterceptor(String compression) {
if (compression == null) {
throw new NullPointerException("Compression cannot be null");
}
this.compression = compression;
}
@Override
public ServerCall.Listener interceptCall(
ServerCall call,
Metadata headers,
ServerCallHandler next) {
call.setCompression(compression);
return next.startCall(call, headers);
}
}