seninel部署
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 6 година
123456789101112131415161718192021222324252627282930313233343536
  1. # Sentinel gRPC Adapter
  2. Sentinel gRPC Adapter provides client and server interceptor for gRPC services.
  3. > Note that currently the interceptor only supports unary methods in gRPC.
  4. ## Client Interceptor
  5. Example:
  6. ```java
  7. public class ServiceClient {
  8. private final ManagedChannel channel;
  9. ServiceClient(String host, int port) {
  10. this.channel = ManagedChannelBuilder.forAddress(host, port)
  11. .intercept(new SentinelGrpcClientInterceptor()) // Add the client interceptor.
  12. .build();
  13. // Init your stub here.
  14. }
  15. }
  16. ```
  17. ## Server Interceptor
  18. Example:
  19. ```java
  20. import io.grpc.Server;
  21. Server server = ServerBuilder.forPort(port)
  22. .addService(new MyServiceImpl()) // Add your service.
  23. .intercept(new SentinelGrpcServerInterceptor()) // Add the server interceptor.
  24. .build();
  25. ```