-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
What version of gRPC are you using?
1.27.0-dev
What version of Go are you using (go version)?
go version go1.13.4 darwin/amd64
What operating system (Linux, Windows, …) and version?
MacOS Mojave v10.14.6
What did you do?
Steps to reproduce:
- Clone my fork of Apache Pulsar:
git clone https://github.com/devinbost/pulsar.git - Review the source gRPC .proto file for InstanceCommunication located at
pulsar-functions/proto/src/main/proto/InstanceCommunication.proto
Note that it contains this service definition:
service InstanceControl {
rpc GetFunctionStatus(google.protobuf.Empty) returns (FunctionStatus) {}
rpc GetAndResetMetrics(google.protobuf.Empty) returns (MetricsData) {}
rpc ResetMetrics(google.protobuf.Empty) returns (google.protobuf.Empty) {}
rpc GetMetrics(google.protobuf.Empty) returns (MetricsData) {}
rpc HealthCheck(google.protobuf.Empty) returns (HealthCheckResult) {}
}
- Change directory to pb folder in
pulsar-function-gomodule:
cd pulsar/pulsar-function-go/pb - Execute
generate.shscript to generate gRPC files. (Need to pass top-level path to Pulsar directory.)
e.g.
./generate.sh /Users/dbost/src/dbost_pulsar/pulsar - Inspect the gRPC file generated at
pulsar-function-go/pb/InstanceCommunication.pb.go
Note that no method was generated for registration of the service.
What did you expect to see?
The gRPC documentation for Go (https://grpc.io/docs/reference/go/generated-code/) states:
On the server side, each service Bar in the .proto file results in the function:
func RegisterBarServer(s *grpc.Server, srv BarServer)
The application can define a concrete implementation of the BarServer interface and register it with a grpc.Server instance (before starting the server instance) by using this function.
Since our service is named InstanceCommunication (as per the code sample provided above), we expect the generated InstanceCommunication.pb.go file to contain a method with this signature:
RegisterInstanceControlServer(s *grpc.Server, srv InstanceControlServer)
to allow us to register the gRPC server.
What did you see instead?
No such RegisterInstanceControlServer(s *grpc.Server, srv InstanceControlServer) method was generated in the generated InstanceCommunication.pb.go file. As a consequence, there is no method available to register the gRPC server for Go.