Codebase list golang-github-go-kit-kit / 2855aef
style fixes David Sudia 6 years ago
1 changed file(s) with 23 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
00 # grpc
11
2 [gRPC](http://www.grpc.io/) is an excellent, modern IDL and transport for microservices.
3 If you're starting a greenfield project, Go kit strongly recommends gRPC as your default transport.
2 [gRPC](http://www.grpc.io/) is an excellent, modern IDL and transport for
3 microservices.
4 If you're starting a greenfield project, go-kit strongly recommends gRPC as
5 your default transport.
46
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.
7 One important note is that while gRPC supports streaming requests and replies,
8 go-kit does not. You can still use streams in your service, but their
9 implementation will not be able to take advantage of many go-kit features like middleware.
610
7 Using gRPC and Go kit together is very simple.
11 Using gRPC and go-kit together is very simple.
812
913 First, define your service using protobuf3.
1014 This is explained [in gRPC documentation](http://www.grpc.io/docs/#defining-a-service).
11 See [add.proto](https://github.com/go-kit/kit/blob/ec8b02591ee873433565a1ae9d317353412d1d27/examples/addsvc/pb/add.proto) for an example.
12 Make sure the proto definition matches your service's Go kit (interface) definition.
15 See
16 [add.proto](https://github.com/go-kit/kit/blob/ec8b02591ee873433565a1ae9d317353412d1d27/examples/addsvc/pb/add.proto)
17 for an example.
18 Make sure the proto definition matches your service's go-kit (interface) definition.
1319
1420 Next, get the protoc compiler.
1521
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!
22 You can download pre-compiled binaries from the
23 [protobuf release page](https://github.com/google/protobuf/releases).
24 You will unzip a folder called `protoc3` with a subdirectory `bin` containing an executable.
25 Move that executable somewhere in your `$PATH` and you're good to go!
1726
1827 It can also be built from source.
1928
3241
3342 Finally, write a tiny binding from your service definition to the gRPC definition.
3443 It's a simple conversion from one domain to another.
35 See [grpc_binding.go](https://github.com/go-kit/kit/blob/ec8b02591ee873433565a1ae9d317353412d1d27/examples/addsvc/grpc_binding.go) for an example.
44 See
45 [grpc_binding.go](https://github.com/go-kit/kit/blob/ec8b02591ee873433565a1ae9d317353412d1d27/examples/addsvc/grpc_binding.go)
46 for an example.
3647
3748 That's it!
3849 The gRPC binding can be bound to a listener and serve normal gRPC requests.
39 And within your service, you can use standard Go kit components and idioms.
40 See [addsvc](https://github.com/go-kit/kit/tree/master/examples/addsvc) for a complete working example with gRPC support.
41 And remember: Go kit services can support multiple transports simultaneously.
50 And within your service, you can use standard go-kit components and idioms.
51 See [addsvc](https://github.com/go-kit/kit/tree/master/examples/addsvc) for a complete
52 working example with gRPC support.
53 And remember: go-kit services can support multiple transports simultaneously.