feat kafka
This commit is contained in:
@@ -21,8 +21,9 @@ func (p *Program) Init(_ svc.Environment) error {
|
||||
return err
|
||||
}
|
||||
p.moduleList = append(p.moduleList, base)
|
||||
p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB))
|
||||
p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB, common.KeyDiscoverServiceNameQgdzs))
|
||||
p.moduleList = append(p.moduleList, (&module.Grpc{}).Bind(grpc_server.NewServer(config.Get().Serve.Grpc)))
|
||||
p.moduleList = append(p.moduleList, &ModuleTimer{})
|
||||
p.moduleList = append(p.moduleList, (&module.Prometheus{}).Bind(config.Get().Metric))
|
||||
p.moduleList = append(p.moduleList, (&module.Tracer{}).Bind(config.Get().Metric, common.KeyDiscoverServiceNameQgdzs))
|
||||
p.moduleList = append(p.moduleList, &module.Discover{})
|
||||
|
||||
29
app/timer.go
Normal file
29
app/timer.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/module"
|
||||
"git.hlsq.asia/mmorpg/service-qgdzs/internal/timer"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ModuleTimer 定时器模块
|
||||
type ModuleTimer struct {
|
||||
module.DefaultModule
|
||||
timer *timer.Timer
|
||||
}
|
||||
|
||||
func (m *ModuleTimer) Init() error {
|
||||
m.timer = &timer.Timer{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ModuleTimer) Start(ready *sync.WaitGroup) error {
|
||||
m.timer.Start()
|
||||
ready.Done()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ModuleTimer) Stop() error {
|
||||
m.timer.Stop()
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user