mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
[ISSUE #3949] allow to add user-defined gRPC Server interceptors.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.apache.rocketmq.proxy.grpc;
|
||||
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.ServerInterceptor;
|
||||
import io.grpc.ServerServiceDefinition;
|
||||
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
|
||||
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
|
||||
@@ -100,6 +101,11 @@ public class GrpcServerBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public GrpcServerBuilder appendInterceptor(ServerInterceptor interceptor) {
|
||||
this.serverBuilder.intercept(interceptor);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GrpcServer build() {
|
||||
return new GrpcServer(this.serverBuilder.build());
|
||||
}
|
||||
|
||||
-3
@@ -21,9 +21,6 @@ import io.grpc.Context;
|
||||
import io.grpc.Metadata;
|
||||
|
||||
public class InterceptorConstants {
|
||||
private InterceptorConstants() {
|
||||
}
|
||||
|
||||
public static final Context.Key<Metadata> METADATA = Context.key("rpc-metadata");
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user