The correct definition of service in .proto file

45 views
Skip to first unread message

王迁

unread,
Feb 21, 2017, 1:33:06 AM2/21/17
to grpc.io
There are two kind of service definition in grpc official guide,

one is:
service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse); // end with ;
}

and the other is:
service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse) {} // end with {}
}


Is there some difference between them?

Thanks!

Jan Tattermusch

unread,
Feb 21, 2017, 4:11:18 AM2/21/17
to 王迁, grpc.io
Hi,

You can add service options inside {  }. See https://developers.google.com/protocol-buffers/docs/proto3#options (if you don't know what message, service etc. options are, chances are you can safely ignore they exist).

Jan

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/08bdeeae-4aed-4fe6-969f-593e7c63fc56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

王迁

unread,
Feb 21, 2017, 9:23:02 PM2/21/17
to grpc.io, wangqi...@gmail.com
Thanks Jan, I read doc about options and the file descriptor.proto. It seems quite an advance usage and I choose to ignore them ^_^.

在 2017年2月21日星期二 UTC+8下午5:11:18,Jan Tattermusch写道:
Hi,

You can add service options inside {  }. See https://developers.google.com/protocol-buffers/docs/proto3#options (if you don't know what message, service etc. options are, chances are you can safely ignore they exist).

Jan
On Mon, Feb 20, 2017 at 10:33 PM, 王迁 <wangqi...@gmail.com> wrote:
There are two kind of service definition in grpc official guide,

one is:
service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse); // end with ;
}

and the other is:
service HelloService {
  rpc SayHello (HelloRequest) returns (HelloResponse) {} // end with {}
}


Is there some difference between them?

Thanks!

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages