Compose or nest a service in another service?

798 views
Skip to first unread message

Thomas Sörensen

unread,
Jan 27, 2018, 3:22:50 AM1/27/18
to grpc.io
Not sure if this is gRPC question or a protocol buffer questions but I try here.

I know that you can compose or nest messages in other messages and import messages from other .proto files and I wonder if it is possible to do the same for the service definition? If it is not possible now is it something that is planned to support in the future?

I read that is possible in Apache Thrift so perhaps you have had any discussions on about supporting that?

Best regards
Thomas

Josh Humphries

unread,
Jan 27, 2018, 10:15:14 AM1/27/18
to Thomas Sörensen, grpc.io
The question could be asked about either protobuf or gRPC with different answers.

The protobuf IDL that does not allow combining/composing services this way. A single service can only enumerate methods. You cannot nest services inside others.

However, gRPC does support such composition -- in a way -- by letting you expose multiple services from a single server. In fact, you could have a single server object that implements all of the protobuf service interfaces. So you are effectively using an implementation language (not protobuf) to compose the services, and then exposing all of the interfaces from a single gRPC server.


----
Josh Humphries
jh...@bluegosling.com

--
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/035d13e9-5b99-470f-87e2-2c67725d64ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Sörensen

unread,
Jan 29, 2018, 1:32:15 AM1/29/18
to grpc.io
Ok thank you for the good feedback. I have application and I want to implement some components in a more suitable language and grpc seems to be a good choice to connect those components.

/Thomas


Den lördag 27 januari 2018 kl. 16:15:14 UTC+1 skrev Josh Humphries:
The question could be asked about either protobuf or gRPC with different answers.

The protobuf IDL that does not allow combining/composing services this way. A single service can only enumerate methods. You cannot nest services inside others.

However, gRPC does support such composition -- in a way -- by letting you expose multiple services from a single server. In fact, you could have a single server object that implements all of the protobuf service interfaces. So you are effectively using an implementation language (not protobuf) to compose the services, and then exposing all of the interfaces from a single gRPC server.


----
Josh Humphries
jh...@bluegosling.com

On Sat, Jan 27, 2018 at 3:22 AM, Thomas Sörensen <soren...@gmail.com> wrote:
Not sure if this is gRPC question or a protocol buffer questions but I try here.

I know that you can compose or nest messages in other messages and import messages from other .proto files and I wonder if it is possible to do the same for the service definition? If it is not possible now is it something that is planned to support in the future?

I read that is possible in Apache Thrift so perhaps you have had any discussions on about supporting that?

Best regards
Thomas

--
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