DMwangnima commented on code in PR #2494: URL: https://github.com/apache/dubbo-go/pull/2494#discussion_r1387426058
########## dubbo.go: ########## @@ -137,3 +145,63 @@ func (ins *Instance) NewServer(opts ...server.ServerOption) (*server.Server, err } return srv, nil } + +func (ins *Instance) Start() (err error) { + startOnce.Do(func() { + // todo gracefulShutdown + if err = ins.LoadConsumer(); err != nil { + return + } + if err = ins.LoadProvider(); err != nil { + return + } + }) + return err +} + +// LoadProvider loads the service provider. +func (ins *Instance) LoadProvider() error { + srv, err := ins.NewServer() + if err != nil { + return err + } + // register services + for _, definition := range providerServices { + if err = srv.Register(definition.Handler, definition.Info, definition.Opts...); err != nil { + return err + } + } + return srv.Start() +} + +// LoadConsumer loads the service consumer. +func (ins *Instance) LoadConsumer() error { Review Comment: ditto. ########## dubbo.go: ########## @@ -137,3 +145,63 @@ func (ins *Instance) NewServer(opts ...server.ServerOption) (*server.Server, err } return srv, nil } + +func (ins *Instance) Start() (err error) { + startOnce.Do(func() { + // todo gracefulShutdown + if err = ins.LoadConsumer(); err != nil { + return + } + if err = ins.LoadProvider(); err != nil { + return + } + }) + return err +} + +// LoadProvider loads the service provider. +func (ins *Instance) LoadProvider() error { Review Comment: ditto. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org