- Building Microservices with Go
- Nic Jackson
- 210字
- 2021-07-15 17:28:14
Protocol Buffers
Protocol Buffers are a Google product, and they have just entered their third revision. Protocol Buffers take the approach of providing a DSL that the generator (written in C) reads and can generate client and server stubs for over ten languages, the primary ten are maintained by Google and encompass: Go, Java, C, JavaScript for NodeJS.
Protocol Buffers is a pluggable architecture, so it is possible to write your own plugins to generate all kinds of endpoints not just RPC; however, RPC is the main use case as they are coupled to the gRPC framework.
gRPC was designed by Google to be a fast and language agnostic RPC framework, which originated from an internal project where latency and speed were of the utmost importance in Google's architecture. By default, gRPC uses protocol buffers as the method for serializing and de-serializing structured data. An example of this DSL is shown in the following example.
Protocol buffer service definition:
service Users {
rpc CreateUser (User) returns (Error) {}
}
message User {
required string name = 1;
required int32 id = 2;
optional string email = 3;
}
message Error {
optional code int32 = 1
optional detail string = 2
}
Find more information on Protocol Buffers at https://developers.google.com/protocol-buffers/.
- 深度實踐OpenStack:基于Python的OpenStack組件開發
- 深入理解Bootstrap
- Java高并發核心編程(卷2):多線程、鎖、JMM、JUC、高并發設計模式
- 從程序員到架構師:大數據量、緩存、高并發、微服務、多團隊協同等核心場景實戰
- 青少年美育趣味課堂:XMind思維導圖制作
- PHP+MySQL網站開發技術項目式教程(第2版)
- Java游戲服務器架構實戰
- Apache Mesos Essentials
- Learning Python Design Patterns
- 運用后端技術處理業務邏輯(藍橋杯軟件大賽培訓教材-Java方向)
- 響應式架構:消息模式Actor實現與Scala、Akka應用集成
- Internet of Things with ESP8266
- Unity 3D/2D移動開發實戰教程
- Everyday Data Structures
- Django Design Patterns and Best Practices