Documentation ¶
Index ¶
- Variables
- func AddSynonym(toService, synonymService string)
- func AddSynonyms(priorToRealService bool, maps map[string]string)
- func Invoke(serviceName, packageName, pbServiceName, methodName string, in proto.Message, ...)
- func InvokeDirectViaHub(serviceName, pbServiceName, methodName string, in proto.Message, ...)
- func RequestRefreshAllClients()
- func RequestRefreshClient(name string)
- func Start() echo.HandlerFunc
- func Stop()
- type BC
- type DepRecord
- type GrpcClient
- type GrpcHub
- type Input
Constants ¶
This section is empty.
Variables ¶
View Source
var RegistrarChangesHandler = func(evType store.Event_EventType, key []byte, value []byte) { k := string(key) v := string(value) if len(k) > 0 && k[0] == '/' { k = k[1:] } parts := strings.Split(k, "/") if parts[0] != "services" { parts = parts[1:] } if parts[0] == "services" { if len(parts) > 4 && parts[4] == api.GRPC { onUpdatedAx(evType, parts[1], parts[2], parts[3], v) } else if len(parts) > 1 { logrus.Debugf(">>> registrar changing: %v, %v, %v", store.EvTypeToString(evType), parts[1], v) } else { logrus.Debugf(">>> registrar changing: %v, %v, %v", store.EvTypeToString(evType), k, v) } } }
View Source
var RegistrarOkCallback = func(r *gwk.Registrar, serviceName string) { logrus.Debugf("registrar connected: %s, %v", serviceName, r) serviceAddDepEntry(serviceName, ":1") // 添加依赖服务的条目 var out = make(map[string]*DepRecord) _ = vxconf.LoadSectionTo("server.deps", out) for k := range out { serviceAddDepEntry(k, ":1") } }
Functions ¶
func AddSynonym ¶
func AddSynonym(toService, synonymService string)
func AddSynonyms ¶
maps: key is toService, value is its replaced (synonymService)
func Invoke ¶
func Invoke(serviceName, packageName, pbServiceName, methodName string, in proto.Message, out proto.Message, callback func(error, *Input, proto.Message))
Usage:
scheduler.Invoke("vx-user", "user", "UserAction", "Login", &user.LoginReq{...}, nil, func(e error, input *scheduler.Input, out interface{}) { ... })
注意:out 传入 nil 意味着对方接口是返回 *v10.Result 结构的;如果返回类型不是,则应传入正确的类型和实例以便容纳返回值
func InvokeDirectViaHub ¶
func InvokeDirectViaHub(serviceName, pbServiceName, methodName string, in proto.Message, out proto.Message, callback func(error, *Input, proto.Message))
InvokeDirectViaHub invokes grpc api via `grpcHub` main loop and a child go-routine 除非是 vx-core, 并且目标grpc服务在同一进程空间内,否则不要使用此功能(InvokeDirectViaHub)
func RequestRefreshAllClients ¶
func RequestRefreshAllClients()
func RequestRefreshClient ¶
func RequestRefreshClient(name string)
Types ¶
type GrpcClient ¶
type GrpcClient struct { // Conn *grpc.ClientConn Name string Peers []*balance2.ServicePeer // contains filtered or unexported fields }
func (*GrpcClient) Send ¶
func (c *GrpcClient) Send(input *Input)
Click to show internal directories.
Click to hide internal directories.