| | |
| | | } |
| | | |
| | | func NewMicroNode(ctx context.Context,q chan os.Signal, serverId string, reg *RegisterInfo, fnLog func(v ...interface{})) (*MicroNode, error){ |
| | | conf := NewConfig(KEY_REGISTER,512,5,1000,100,1000, fnLog) |
| | | conf := NewConfig(KEY_REGISTER,512,5,1000,1000,1000, fnLog) |
| | | handle, err := Register(ctx, q, conf, reg) |
| | | if err != nil { |
| | | return nil, err |
| | |
| | | //收到其它进程的请求消息 |
| | | go ms.serve(msgR, keyR) |
| | | } |
| | | |
| | | time.Sleep(50 * time.Millisecond) |
| | | } |
| | | } |
| | | } |
| | |
| | | Msg: err.Error(), |
| | | } |
| | | } else { |
| | | ms.printLog("reqBody:", reqBody, "to key: ", p) |
| | | ms.printLog("srcProc:", msgR.SrcProc,"reqBody Path:", reqBody.Path, " contentType:", reqBody.ContentType, " formMap:",reqBody.FormMap, " postFormMap:", reqBody.PostFormMap, "to key: ", p) |
| | | |
| | | if f,ok := ms.handlers[reqBody.Path];ok { |
| | | reqBody.SrcProc = msgR.SrcProc |
| | | ri = f(&reqBody) |
| | | ms.printLog("call funcMap f,reply:", *ri) |
| | | } else { |
| | | ms.printLog("ms.funcMap not eixst path") |
| | | ms.printLog("ms.funcMap not eixst path: ", reqBody.Path) |
| | | ri = &Reply{ |
| | | Success: false, |
| | | Msg: "请求的接口不存在,请检查url", |