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.

README.md 925B

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