tsar2512
tsar2512

Reputation: 2994

RPC in Google Protobuf services

Can a single protobuf service definition have more than one rpc calls defined?

service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse);
  rpc SayHello2 (HelloRequest2) returns (HelloResponse2);
  rpc SayHello (HelloRequest3) returns (HelloResponse3);
}

The protobuf definitions don't specify it anywhere but seems like all examples have just one.

Upvotes: 2

Views: 1209

Answers (1)

Oleg Sklyar
Oleg Sklyar

Reputation: 10082

Interestingly enough, a clear statement is missing in the Defining Services section of protobuf documentation, but the following example is taken from grpc documentation, which clearly answers your question:

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
  // Sends another greeting
  rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}
}

Upvotes: 3

Related Questions