作者 唐旭辉

更新

... ... @@ -26,13 +26,16 @@ func main() {
return
}
go func() {
logs.Info("应用启动")
beego.Run()
}()
for {
select {
case <-sigs:
cancel()
closeConsumer()
return
default:
}
}()
logs.Info("应用启动")
beego.Run()
}
}
... ...
... ... @@ -9,10 +9,10 @@ var Cfg MqConfig
func init() {
Cfg = MqConfig{
Servers: []string{"192.168.190.136:9092"},
Servers: []string{"106.52.15.41:9092"},
ConsumerId: "partnermg",
}
}
// "",
// "192.168.190.136:9092",
// "106.52.15.41:9092"
... ...
... ... @@ -100,7 +100,7 @@ func StartConsumer(ctx context.Context) (func(), error) {
}()
//等待 consumerGroup 设置完成
<-consumer.ready
logs.Error("Sarama consumer up and running!...")
logs.Info("Sarama consumer up and running!...")
return func() {
wg.Wait()
if err := consumerGroup.Close(); err != nil {
... ...