seninel部署
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

1234567891011121314151617181920212223242526272829303132333435363738
  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. > In some circumstances (e.g. asynchronous call), the RT metrics might not be accurate.
  5. ## Client Interceptor
  6. Example:
  7. ```java
  8. public class ServiceClient {
  9. private final ManagedChannel channel;
  10. ServiceClient(String host, int port) {
  11. this.channel = ManagedChannelBuilder.forAddress(host, port)
  12. .intercept(new SentinelGrpcClientInterceptor()) // Add the client interceptor.
  13. .build();
  14. // Init your stub here.
  15. }
  16. }
  17. ```
  18. ## Server Interceptor
  19. Example:
  20. ```java
  21. import io.grpc.Server;
  22. Server server = ServerBuilder.forPort(port)
  23. .addService(new MyServiceImpl()) // Add your service.
  24. .intercept(new SentinelGrpcServerInterceptor()) // Add the server interceptor.
  25. .build();
  26. ```