gRPC Overview
Learn about the core concepts of gRPC in Goa and how it integrates with Protocol Buffers
Goa provides comprehensive support for building gRPC services through its DSL and code generation capabilities. It handles the complete lifecycle of gRPC service development, from service definition to Protocol Buffer generation and server/client implementation.
Goa’s gRPC support includes:
.proto
files from your service definitionsDefine a basic gRPC service:
var _ = Service("calculator", func() {
// Enable gRPC transport
GRPC(func() {
// Configure protoc options
Meta("protoc:path", "protoc")
Meta("protoc:version", "v3")
})
Method("add", func() {
Payload(func() {
Field(1, "a", Int)
Field(2, "b", Int)
Required("a", "b")
})
Result(func() {
Field(1, "sum", Int)
})
})
})
Generate the service code:
goa gen calc/design
This generates: