go-common/app/service/live/xroom-feed/api/client.go

28 lines
545 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package api
import (
"context"
"google.golang.org/grpc"
"go-common/library/net/rpc/warden"
)
const AppID = "live.xroomfeed"
type Client struct {
RecPoolClient RecPoolClient
}
// NewClient xroom-feed grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (*Client, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
if err != nil {
return nil, err
}
cli := &Client{}
cli.RecPoolClient = NewRecPoolClient(conn)
return cli, nil
}