deprecated_overflow_gateway.../grpc/pool_handlers.go

28 lines
558 B
Go
Raw Normal View History

2017-09-11 02:24:18 +00:00
package grpc
import (
"context"
"google.golang.org/grpc"
cgp "git.loafle.net/commons_go/grpc_pool"
oas "git.loafle.net/overflow/overflow_api_server/golang"
2017-09-19 08:38:59 +00:00
"git.loafle.net/overflow/overflow_gateway_probe/conf"
2017-09-11 02:24:18 +00:00
)
type poolHandlers struct {
cgp.PoolHandlers
2017-09-11 04:42:52 +00:00
ctx context.Context
2017-09-11 02:24:18 +00:00
}
func (h *poolHandlers) OnCreate() (*grpc.ClientConn, interface{}, error) {
var err error
2017-09-19 08:38:59 +00:00
conn, err := grpc.Dial(conf.Config.GRPC.Addr, grpc.WithInsecure())
2017-09-11 02:24:18 +00:00
if nil != err {
return nil, nil, err
}
c := oas.NewOverflowApiServerClient(conn)
return conn, c, nil
}