I have been trying to generate the basic gRPC client and server interfaces from a .proto
service definition here from the grpc official repo.
The relevant service defined in that file (from the link above) is below:
service RouteGuide {
rpc GetFeature(Point) returns (Feature) {}
rpc ListFeatures(Rectangle) returns (stream Feature) {}
rpc RecordRoute(stream Point) returns (RouteSummary) {}
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
}
The command I run is protoc --java_out=${OUTPUT_DIR} path/to/proto/file
According to the grpc site (specifically here), a RouteGuideGrpc.java
which contains a base class RouteGuideGrpc.RouteGuideImplBase
, with all the methods defined in the RouteGuide service is supposed to have been generated from the protoc
command above, but that file does not get generated for me.
Has anyone faced similar issues? Is the official documentation simply incorrect? And would anyone have any suggestion as to what I can do to generate that missing class?
proto-gen-grpc-java
you can also use the--plugin
flag. See https://mcmap.net/q/361826/-protoc-not-generating-service-stub-files – Jovia