SHARE
TWEET

Untitled

a guest Oct 10th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top