Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update grpc readme information about protoc and streams #557

Merged
merged 4 commits into from
Jul 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions transport/grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@

[gRPC](http://www.grpc.io/) is an excellent, modern IDL and transport for microservices.
If you're starting a greenfield project, Go kit strongly recommends gRPC as your default transport.
And using gRPC and Go kit together is very simple.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap at 80 columns. Also, "Go kit", not "go-kit".


Using gRPC and Go kit together is very simple.

First, define your service using protobuf3.
This is explained [in gRPC documentation](http://www.grpc.io/docs/#defining-a-service).
See [add.proto](https://github.com/go-kit/kit/blob/ec8b02591ee873433565a1ae9d317353412d1d27/examples/addsvc/pb/add.proto) for an example.
Make sure the proto definition matches your service's Go kit (interface) definition.

Next, get the protoc compiler.
Unfortunately, this needs to be done from source.
Fortunately, it's pretty straightforward.

```
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!

It can also be built from source.

```sh
brew install autoconf automake libtool
git clone https://github.com/google/protobuf
cd protobuf
Expand All @@ -22,7 +27,7 @@ cd protobuf

Then, compile your service definition, from .proto to .go.

```
```sh
protoc add.proto --go_out=plugins=grpc:.
```

Expand Down