Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. @Service
  2. public class GRPCClientService {
  3. public String ping() {
  4. ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090)
  5. .usePlaintext()
  6. .build();
  7.  
  8. PingPongServiceGrpc.PingPongServiceBlockingStub stub
  9. = PingPongServiceGrpc.newBlockingStub(channel);
  10.  
  11. PongResponse helloResponse = stub.ping(PingRequest.newBuilder()
  12. .setPing("")
  13. .build());
  14.  
  15. channel.shutdown();
  16.  
  17. return helloResponse.getPong();
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement