mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-13 11:07:34 +08:00
1.支持动态服务发现功能
2.Service中支持对RPC结点连接或断开事件监听
This commit is contained in:
@@ -63,7 +63,7 @@ type RpcHandler struct {
|
||||
callResponseCallBack chan *Call //异步返回的回调
|
||||
}
|
||||
|
||||
type TriggerRpcEvent func(bConnect bool,nodeId int)
|
||||
type TriggerRpcEvent func(bConnect bool,clientSeq uint32,nodeId int)
|
||||
type IRpcListener interface {
|
||||
OnRpcConnected(nodeId int)
|
||||
OnRpcDisconnect(nodeId int)
|
||||
@@ -467,6 +467,9 @@ func (handler *RpcHandler) asyncCallRpc(nodeid int,serviceMethod string,args int
|
||||
var pClientList [maxClusterNode]*Client
|
||||
err,count := handler.funcRpcClient(nodeid,serviceMethod,pClientList[:])
|
||||
if count==0||err != nil {
|
||||
if err == nil {
|
||||
err = fmt.Errorf("cannot find rpcclient from nodeid %d serviceMethod %s",nodeid,serviceMethod)
|
||||
}
|
||||
fVal.Call([]reflect.Value{reflect.ValueOf(reply),reflect.ValueOf(err)})
|
||||
log.Error("Call serviceMethod is error:%+v!",err)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user