chenledong c8df7e7456 Improve RT statistic and exception tracing in Sentinel gRPC adapter (#995) | 5 lat temu | |
---|---|---|
.. | ||
src | 5 lat temu | |
README.md | 5 lat temu | |
pom.xml | 5 lat temu |
Sentinel gRPC Adapter provides client and server interceptor for gRPC services.
Note that currently the interceptor only supports unary methods in gRPC.
Example:
public class ServiceClient {
private final ManagedChannel channel;
ServiceClient(String host, int port) {
this.channel = ManagedChannelBuilder.forAddress(host, port)
.intercept(new SentinelGrpcClientInterceptor()) // Add the client interceptor.
.build();
// Init your stub here.
}
}
Example:
import io.grpc.Server;
Server server = ServerBuilder.forPort(port)
.addService(new MyServiceImpl()) // Add your service.
.intercept(new SentinelGrpcServerInterceptor()) // Add the server interceptor.
.build();