Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Service
- public class GRPCClientService {
- public String ping() {
- ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090)
- .usePlaintext()
- .build();
- PingPongServiceGrpc.PingPongServiceBlockingStub stub
- = PingPongServiceGrpc.newBlockingStub(channel);
- PongResponse helloResponse = stub.ping(PingRequest.newBuilder()
- .setPing("")
- .build());
- channel.shutdown();
- return helloResponse.getPong();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement