<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.38.0</version>
</dependency>
</dependencies>
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50051)
.usePlaintext()
.build();
BlockingStub blockingStub = YourServiceGrpc.newBlockingStub(channel)
YourResponse response = blockingStub.yourMethod(yourRequest);
channel.shutdown();
proto
service YourService {
rpc YourMethod (YourRequest) returns (YourResponse) {}
}
YourRequest request = YourRequest.newBuilder()
.setField1("value1")
.setField2("value2")
.build();
YourResponse response = blockingStub.yourMethod(request);
ManagedChannel channel = NettyChannelBuilder.forAddress("localhost", 50051)
.build();