Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rchanger/go-grpc

Small demonstration of working with grpc in golang
https://github.com/rchanger/go-grpc

go-grpc golang grpc proto

Last synced: about 1 month ago
JSON representation

Small demonstration of working with grpc in golang

Awesome Lists containing this project

README

        

# Go-gRPC
This is simple demonstration of how grpc is to be used with golang.

## Setting up the environment required for grpc.
1. Download and install protoc form below link:
~~~
https://github.com/protocolbuffers/protobuf/releases
~~~
2. Next, install Go support for Google’s protocol buffers and grpc:
~~~
go get -u github.com/golang/protobuf/protoc-gen-go
go install github.com/golang/protobuf/protoc-gen-go
go get google.golang.org/grpc
~~~

## Running Demo examples.
1. Unary gRPC is explained with example of addition and subtraction example.You will find the example inside __SimpleGRPC__ directory.
For simple/unary grpc sample.pb.go file is generated by executing following command:
~~~
protoc -I SimpleGRPC/ProtoDir/ ./SimpleGRPC/ProtoDir/sample.proto --go_out=plugins=grpc:SimpleGRPC/ProtoDir/
~~~

2. Server Side Streaming type of grpc is explained with the help of small example of finding Divisors of number.It is present under __ServerSideStreaming__ directory.
For server side streaming grpc serverStreamingProto.pb.go file is generated by executing following command:
~~~
protoc -I ServerSideStreaming/ServerSideStreamingProto/ ./ServerSideStreaming/ServerSideStreamingProto/serverStreamingProto.proto --go_out=plugins=grpc:ServerSideStreaming/ServerSideStreamingProto/
~~~

3. Client Side Streaming type of grpc is explained with the help of small example of finding max number from stream of number.The example is present under __ClientSideStramingGRPC__ directory.
For client side streaming grpc clientstraming.pb.go file is generated by executing following command:
~~~
protoc -I ClientSideStramingGRPC/ClientSideStramingProto/ ./ClientSideStramingGRPC/ClientSideStramingProto/clientstraming.proto --go_out=plugins=grpc:ClientSideStramingGRPC/ClientSideStramingProto/
~~~

4. Bidirectional Streaming type of grpc is explained with the help of small example of finding max number from stream of number.The example is present under __BiDirectionGRPC__ directory.
For bidirectional streaming grpc bidirctionalProto.pb.go file is generated by executing following command:
~~~
protoc -I BiDirectionGRPC/BiDirProto/ ./BiDirectionGRPC/BiDirProto/bidirctionalProto.proto --go_out=plugins=grpc:BiDirectionGRPC/BiDirProto/
~~~



#### Small Presentation on grpc: https://drive.google.com/open?id=1_-zI9DtOOa-LYHC79Bdi8YYlIDMt46KISFh35wvaZxI