1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/plugins/server/grpc
Johnson C 90b3e4af0b
[fix] ignore unexported field (#2354)
ignore unexported field when register endpoints
2021-11-18 17:07:00 +08:00
..
proto go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
codec.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
context.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
error.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
extractor_test.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
extractor.go [fix] ignore unexported field (#2354) 2021-11-18 17:07:00 +08:00
go.mod upgrade to go 1.17 (#2346) 2021-11-11 14:03:34 +00:00
go.sum upgrade to go 1.17 (#2346) 2021-11-11 14:03:34 +00:00
grpc_test.go remove unnecessary dependencies between plugins 2021-10-23 16:20:42 +08:00
grpc.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
handler.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
options.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
README.md update 2021-10-13 13:31:23 +01:00
request.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
response.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
server.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
stream.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
subscriber.go go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
util.go refactor all the things 2020-12-29 15:49:26 +00:00

GRPC Server

The grpc server is a micro.Server compatible server.

Overview

The server makes use of the google.golang.org/grpc framework for the underlying server but continues to use micro handler signatures and protoc-gen-micro generated code.

Usage

Specify the server to your micro service

import (
        "go-micro.dev/v4"
        "github.com/asim/go-micro/plugins/server/grpc/v4"
)

func main() {
        service := micro.NewService(
                // This needs to be first as it replaces the underlying server
                // which causes any configuration set before it
                // to be discarded
                micro.Server(grpc.NewServer()),
                micro.Name("greeter"),
        )
}

NOTE: Setting the gRPC server and/or client causes the underlying the server/client to be replaced which causes any previous configuration set on that server/client to be discarded. It is therefore recommended to set gRPC server/client before any other configuration