2017-10-26 12:55:55 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2018-03-16 07:46:31 +00:00
|
|
|
cdr "git.loafle.net/commons_go/di/registry"
|
2017-12-01 08:29:54 +00:00
|
|
|
crr "git.loafle.net/commons_go/rpc/registry"
|
2017-10-26 12:55:55 +00:00
|
|
|
"git.loafle.net/commons_go/server"
|
2018-03-16 07:46:31 +00:00
|
|
|
oodca "git.loafle.net/overflow/overflow_discovery/commons/annotation"
|
|
|
|
oods "git.loafle.net/overflow/overflow_discovery/service"
|
2017-12-05 05:58:32 +00:00
|
|
|
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
|
2017-10-26 12:55:55 +00:00
|
|
|
)
|
|
|
|
|
2017-12-14 08:55:57 +00:00
|
|
|
func New(pidPath string) server.Server {
|
2018-03-16 07:46:31 +00:00
|
|
|
oods.InitService()
|
|
|
|
|
2017-12-01 08:29:54 +00:00
|
|
|
rpcRegistry := crr.NewRPCRegistry()
|
2018-03-16 07:46:31 +00:00
|
|
|
|
|
|
|
services := cdr.GetInstancesByAnnotationName(oodca.ServiceTag)
|
|
|
|
|
|
|
|
for _, s := range services {
|
|
|
|
rpcRegistry.RegisterService(s, "")
|
|
|
|
}
|
2017-11-15 06:59:43 +00:00
|
|
|
|
2017-12-05 05:58:32 +00:00
|
|
|
rpcSH := oopcs.NewRPCServletHandler(rpcRegistry)
|
2017-11-29 05:19:36 +00:00
|
|
|
socketHandler := newSocketHandler(rpcSH)
|
2017-10-26 12:55:55 +00:00
|
|
|
|
2017-12-14 08:55:57 +00:00
|
|
|
sh := newServerHandler(pidPath, socketHandler)
|
2017-12-05 05:58:32 +00:00
|
|
|
s := oopcs.New(sh)
|
2017-10-26 12:55:55 +00:00
|
|
|
|
|
|
|
return s
|
|
|
|
}
|