update grpc readme information about protoc and streams
David Sudia
6 years ago
1 | 1 | |
2 | 2 | [gRPC](http://www.grpc.io/) is an excellent, modern IDL and transport for microservices. |
3 | 3 | If you're starting a greenfield project, Go kit strongly recommends gRPC as your default transport. |
4 | And using gRPC and Go kit together is very simple. | |
4 | ||
5 | One important note is that while gRPC supports streaming requests and replies, go-kit does not. You can still use streams in your service, but their implementation will not be able to take advantage of many go-kit features like middleware. | |
6 | ||
7 | Using gRPC and Go kit together is very simple. | |
5 | 8 | |
6 | 9 | First, define your service using protobuf3. |
7 | 10 | This is explained [in gRPC documentation](http://www.grpc.io/docs/#defining-a-service). |
9 | 12 | Make sure the proto definition matches your service's Go kit (interface) definition. |
10 | 13 | |
11 | 14 | Next, get the protoc compiler. |
12 | Unfortunately, this needs to be done from source. | |
13 | Fortunately, it's pretty straightforward. | |
14 | 15 | |
15 | ``` | |
16 | You can download pre-compiled binaries from the [protobuf release page](https://github.com/google/protobuf/releases). You will unzip a folder called `protoc3` with a subdirectory `bin` containing an executable. Move that executable somewhere in your `$PATH` and you're good to go! | |
17 | ||
18 | It can also be built from source. | |
19 | ||
20 | ```sh | |
16 | 21 | brew install autoconf automake libtool |
17 | 22 | git clone https://github.com/google/protobuf |
18 | 23 | cd protobuf |
21 | 26 | |
22 | 27 | Then, compile your service definition, from .proto to .go. |
23 | 28 | |
24 | ``` | |
29 | ```sh | |
25 | 30 | protoc add.proto --go_out=plugins=grpc:. |
26 | 31 | ``` |
27 | 32 |