-
-
Notifications
You must be signed in to change notification settings - Fork 137
2.4. gRPC
Rafał Lorenz edited this page Jul 2, 2019
·
2 revisions
To generate the gRPC client and server interfaces from .proto service definition, use the protocol buffer compiler protoc
with a special gRPC Go plugin. For more info read
For example to build user gRPC server and client, from the root directory run:
$ cd cmd/user/infrastructure/proto && protoc --go_out=plugins=grpc:. user.proto
Running this command generates the following file in the cmd/user/infrastructure/proto
directory:
- user.pb.go
This contains:
All the protocol buffer code to populate, serialize, and retrieve our request and response message types An interface type (or stub) for clients to call with the methods defined in the services. An interface type for servers to implement, also with the methods defined in the services.