2018-04-06 13:01:28 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2018-04-09 13:37:03 +00:00
|
|
|
cs "git.loafle.net/commons/server-go"
|
2018-04-06 13:01:28 +00:00
|
|
|
ogrs "git.loafle.net/overflow/gateway_rpc/server"
|
2018-04-09 13:37:03 +00:00
|
|
|
"git.loafle.net/overflow/member_gateway_rpc/subscribe"
|
2018-04-06 13:01:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ServerHandler interface {
|
|
|
|
ogrs.ServerHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
type ServerHandlers struct {
|
|
|
|
ogrs.ServerHandlers
|
2018-04-09 13:37:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *ServerHandlers) Init(serverCtx cs.ServerCtx) error {
|
|
|
|
if err := sh.ServerHandlers.Init(serverCtx); nil != err {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
subscribe.InitPackage()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *ServerHandlers) OnStart(serverCtx cs.ServerCtx) error {
|
|
|
|
if err := sh.ServerHandlers.OnStart(serverCtx); nil != err {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
subscribe.StartPackage()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *ServerHandlers) OnStop(serverCtx cs.ServerCtx) {
|
|
|
|
subscribe.StopPackage()
|
|
|
|
|
|
|
|
sh.ServerHandlers.OnStop(serverCtx)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *ServerHandlers) Destroy(serverCtx cs.ServerCtx) {
|
|
|
|
subscribe.DestroyPackage()
|
|
|
|
|
|
|
|
sh.ServerHandlers.Destroy(serverCtx)
|
|
|
|
}
|