Let's say we use gRCP/Protobuf to connect many application. Those application are developped and released at their own team, with their own speed. Over time there will be different version of the the same app (e.g. desktop apps install on user PCs) that use different version on defined interface.
While Protobuf is meant to allow backward compatibility, is there a way to know what version of interface is running at different points?
The simplest implementation is to have interface version equal to app version. But as many languages are used, it is not trivial to implement app versioning in all of them.
So how version interface and let server to know client version? I think server should be able to log
DATETIME connection from AppName v.version [using interface v.version]
protoc compiler If you don't have it already, you need to install the protobuf compiler protoc , version 3.5. 0+ (the newer the better) for the current gRPC version.
Backwards compatibility. The gRPC protocol is designed to support services that change over time. Generally, additions to gRPC services and methods are non-breaking. Non-breaking changes allow existing clients to continue working without changes.
Protobuf is the most commonly used IDL (Interface Definition Language) for gRPC. It's where you basically store your data and function contracts in the form of a proto file.
It can accept input crafted by later versions of protobuf. The sender is backward compatible because it's creating output that can be consumed by earlier versions. So long as you're careful about when and how you change and remove fields, your protobuf will be forward and backward compatible.
Changing a field number - With Protobuf payloads, the field number is used to identify fields on the network. Renaming a package, service or method - gRPC uses the package name, service name, and method name to build the URL. The client gets an UNIMPLEMENTED status from the server.
While Protobuf is meant to allow backward compatibility, is there a way to know what version of interface is running at different points? The simplest implementation is to have interface version equal to app version.
An introduction to gRPC and protocol buffers. This page introduces you to gRPC and protocol buffers. gRPC can use protocol buffers as both its Interface Definition Language ( IDL) and as its underlying message interchange format. If you’re new to gRPC and/or protocol buffers, read this!
A versioning strategy to support changes should be implemented. The gRPC protocol is designed to support services that change over time. Generally, additions to gRPC services and methods are non-breaking. Non-breaking changes allow existing clients to continue working without changes. Changing or deleting gRPC services are breaking changes.
In the upcoming versions of gRPC, there will be a new feature called Server Reflection. This will allow a client to ask the server for the Descriptors that descriptor the proto file being used. Rather than the server knowing about the version the client is running, the client will know what the server is running. If the server descriptor matches the one the client already has, then it will know that they are speaking at the same version.
This will be released in version 1.1
.
Note that Protobufs are designed so that you don't have to do this! If you set up your proto correctly, old and new versions of clients and server should work together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With