lengfaqiang a67356ffd0 sentinel-1.8.6源码改造上传 2 vuotta sitten
..
src a67356ffd0 sentinel-1.8.6源码改造上传 2 vuotta sitten
README.md a67356ffd0 sentinel-1.8.6源码改造上传 2 vuotta sitten
pom.xml a67356ffd0 sentinel-1.8.6源码改造上传 2 vuotta sitten

README.md

Sentinel gRPC Adapter

Sentinel gRPC Adapter provides client and server interceptor for gRPC services.

Note that currently the interceptor only supports unary methods in gRPC.

Client Interceptor

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.
    }
}

Server Interceptor

Example:

import io.grpc.Server;

Server server = ServerBuilder.forPort(port)
     .addService(new MyServiceImpl()) // Add your service.
     .intercept(new SentinelGrpcServerInterceptor()) // Add the server interceptor.
     .build();