# README
gRPC to gRPC
This recipe is a proxy gateway for gRPC end points.
Installation
- Install Go
- Install
protoc-gen-go
library
go get github.com/golang/protobuf/protoc-gen-go
- Download protoc for your respective OS from here.
Extract protoc-$VERSION-$PLATFORM.zip file get theprotoc
binary from bin folder and configure it in PATH.
Setup
git clone https://github.com/project-flogo/grpc
cd grpc
go install
cd examples/json/grpc-to-grpc
Create the gateway:
flogo create -f flogo.json
cd MyProxy
flogo install github.com/project-flogo/grpc/proto/grpc2grpc
flogo build
Testing
Start proxy gateway.
FLOGO_RUNNER_TYPE=DIRECT bin/MyProxy
Start sample gRPC server.
go run main.go -server
#1 Testing PetById method
Run sample gRPC client.
go run main.go -client -port 9096 -method pet -param 2
Now you should see logs in proxy gateway terminal and sample gRPC server terminal. Sample output in client terminal can be seen as below.
res : pet:<id:2 name:"cat2" >
#2 Testing UserByName method
Run sample gRPC client.
go run main.go -client -port 9096 -method user -param user2
Output can be seen as below.
res : user:<id:2 username:"user2" email:"email2" phone:"phone2" >
#3 Testing ListUsers(Server Streaming) method
Run sample gRPC client.
go run main.go -client -port 9096 -method listusers
Streaming data can be observed at client side. Interrupt the sample server to stop streaming.
#4 Testing StoreUsers(Client Streaming) method
Run sample gRPC client.
go run main.go -client -port 9096 -method storeusers
Streaming data can be observed at server side. Interrupt the client to stop streaming.
#5 Testing BulkUsers(Bidirectional Streaming) method
Run sample gRPC client.
go run main.go -client -port 9096 -method bulkusers
Streaming data can be observed at both client and server side. One second delay is kept for veiwing purpose.