This package were based on Protocol Buffers Basics: Go Tutorial with addition of gRPC server up and running.
- To generate messages
protoc --go_out=. --go_opt=paths=source_relative tutorial/proto/addressbook.proto
or with option go_package = "tutorial/proto"; setted in proto fileprotoc --go-grpc_out=. tutorial/proto/addressbook.proto
- To generate services
protoc --go-grpc_out=. --go-grpc_opt=paths=source_relative tutorial/proto/addressbook.proto
orprotoc --go-grpc_out=. tutorial/proto/addressbook.proto
Implementations of interfaces generated in addressbook_grpc.pb.go
accordingly to services definitions in proto file.
As the gRPC server deppends only on interfaces we can easily testing its methods in isolation.
The client uses the proto genereated file to make calls into server methods.
- Style Request and Response approach. RPC Client call a remote method that responds with a single response.
- RPC Client call once a remote method that responds with a stream response (multiples responses until gRPC Server close the stream).
- RPC Client call more than one time a remote method that only responds when gRPC Client close the stream.