Protobuf service cannot find in output file

I define the rpc service in the proto file, but I cannot find any interface or method in the output java file.

$ protoc -v 
libprotoc 2.5.0

proto file:

service EchoService {
    rpc Echo (Person) returns (Person);
}

compile script:

#!/bin/bash

for file in `find src/main/proto -name "*.proto"`; do
    protoc --proto_path=src/main/proto --java_out=src/main/java/ $file
done
+4
source share
1 answer

See parameter java_generic_services. You should add this to your .protofile:

option java_generic_services = true;

However, this is only useful if you have an RPC implementation to use (or want to write your own). The default option is false, because it is expected that most RPC implementations will want to write their own code generator, rather than using the "generic" generated services.

+5
source

All Articles