Packaging Generated Code for gRPC Services

46 views
Skip to first unread message

din...@wepay.com

unread,
Oct 29, 2018, 6:43:10 PM10/29/18
to grpc.io

Hi,

Currently, we maintain a single repository for storing proto files for multiple microservices. And we would use these protobufs for implementing services in specific languages. I recently read this blog which mentions about packaging generated code into libraries and distributing it. I would like to know which is the best recommended option?
1. Package generated code into libraries and distribute it
2. Maintain protos in single repo and distribute it & services/clients can get the proto files and build the generated code and use it

Thanks,
Dinesh P S

Jayant Kolhe

unread,
Oct 29, 2018, 7:03:46 PM10/29/18
to din...@wepay.com, grp...@googlegroups.com

If it fits within your constraints/ development workflow, (2) is recommended. 

If (2) does not work in the workflow, you can use (1).. It is higher cost to maintain, but it works.

Thanks,

 - Jayant


--
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.
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/bf432ebe-250f-4045-b626-68a75957e0ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Michela

unread,
Oct 30, 2018, 7:41:48 PM10/30/18
to grpc.io
#1 has a big drawback. Generated protobuf code is not backwards for forwards compatible between versions of gRPC and protobuf. If you distribute generated code as a library, all users of that library are locked to the same versions of gRPC and protobuf that generated it.

To make #1 work, you need to maintain generated packages for each proto version you want to support times each gRPC version you want to support. Distributing generated code is a versioning nightmare.

Kun Zhang

unread,
Oct 31, 2018, 2:25:59 PM10/31/18
to grpc.io
Generated protobuf code and GRPC code is forward compatible, meaning code generated by an older version of protobuf and GRPC can work with newer version of protobuf and GRPC runtimes.
Reply all
Reply to author
Forward
0 new messages