- 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/.
- Web應(yīng)用系統(tǒng)開發(fā)實踐(C#)
- JavaScript+DHTML語法與范例詳解詞典
- Python自動化運(yùn)維快速入門
- jQuery從入門到精通 (軟件開發(fā)視頻大講堂)
- Functional Programming in JavaScript
- MySQL數(shù)據(jù)庫基礎(chǔ)實例教程(微課版)
- Learning Selenium Testing Tools(Third Edition)
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- The HTML and CSS Workshop
- Nginx實戰(zhàn):基于Lua語言的配置、開發(fā)與架構(gòu)詳解
- Getting Started with Hazelcast(Second Edition)
- Android群英傳
- C語言程序設(shè)計習(xí)題與實驗指導(dǎo)
- OpenCV with Python Blueprints
- Ext JS 4 Plugin and Extension Development