I am trying to integrate a gRPC interface, written in Go by someone else, into my Spring Boot project. From my understanding, the process involves using protoc to convert the .proto file into .java files, which are then copied into the Java project. Afterward, I attempt to create a client and make calls using the following code:
public class MyGrpcClient {
private final MyServiceGrpc.MyServiceBlockingStub blockingStub;
public MyGrpcClient() {
ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50051)
.usePlaintext()
.build();
blockingStub = MyServiceGrpc.newBlockingStub(channel);
}
public MyResponse callRemoteService(MyRequest request) {
return blockingStub.myMethod(request);
}
}
However, I noticed that the generated files from protoc do not contain anything similar to the MyServiceGrpc.MyServiceBlockingStub class. I'm wondering where the issue might lie and what could be causing this problem.
I have already followed the necessary steps to generate the .java files using protoc, and I have checked that the necessary dependencies are included in my Maven/Gradle build file. I'm unsure why the MyServiceGrpc.MyServiceBlockingStub class is not present in the generated files.
Any insights or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated.
Thank you in advance for your help!