|
@ -44,7 +44,7 @@ func (the *consumerHttpProxy) InputInitial() error { |
|
|
//数据入口
|
|
|
//数据入口
|
|
|
the.InApiServer = dbHelper.NewApiServer( |
|
|
the.InApiServer = dbHelper.NewApiServer( |
|
|
the.Info.IoConfig.In.ApiServer.Port, |
|
|
the.Info.IoConfig.In.ApiServer.Port, |
|
|
the.Info.IoConfig.In.ApiServer.Routes, |
|
|
the.Info.IoConfig.In.ApiServer.Routers, |
|
|
) |
|
|
) |
|
|
the.InApiServer.Initial() |
|
|
the.InApiServer.Initial() |
|
|
return nil |
|
|
return nil |
|
@ -59,9 +59,11 @@ func (the *consumerHttpProxy) OutputInitial() error { |
|
|
} |
|
|
} |
|
|
func (the *consumerHttpProxy) Work() { |
|
|
func (the *consumerHttpProxy) Work() { |
|
|
go func() { |
|
|
go func() { |
|
|
router := "POST /onData" |
|
|
for _, router := range the.Info.IoConfig.In.ApiServer.Routers { |
|
|
the.InApiServer.RouteRegister(router, the.onData) |
|
|
the.InApiServer.RouteRegister(router, the.onData) |
|
|
|
|
|
} |
|
|
the.InApiServer.Run() |
|
|
the.InApiServer.Run() |
|
|
|
|
|
|
|
|
}() |
|
|
}() |
|
|
} |
|
|
} |
|
|
func (the *consumerHttpProxy) onData(w http.ResponseWriter, r *http.Request) { |
|
|
func (the *consumerHttpProxy) onData(w http.ResponseWriter, r *http.Request) { |
|
@ -86,6 +88,8 @@ func (the *consumerHttpProxy) onData(w http.ResponseWriter, r *http.Request) { |
|
|
params := map[string]string{ |
|
|
params := map[string]string{ |
|
|
"id": id, |
|
|
"id": id, |
|
|
} |
|
|
} |
|
|
|
|
|
//沿用请求路由
|
|
|
|
|
|
the.outHttpPost.Url += r.URL.String() |
|
|
resp, err := the.outHttpPost.HttpPostWithParams(string(body), params) |
|
|
resp, err := the.outHttpPost.HttpPostWithParams(string(body), params) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return |
|
|
return |
|
|