master
howell 4 years ago
parent 3c5e180115
commit 9d8329d443

@ -30,7 +30,9 @@ func SetUpMq() {
log.Println(err)
}
Conn = &rabbitMq{conn}
}
func SetUpShaMa(){
uri1 := fmt.Sprintf("amqp://%s:%s@%s:%s",
configs.ConfigShaMaMqUser,
configs.ConfigShaMaMqPwd,
@ -46,7 +48,7 @@ func SetUpMq() {
func (o rabbitMq) ListenRetry(queue string, count int, handler func([]byte) error) {
log.Printf("start listening ... %s\n", queue)
ch, err := Conn.Channel()
ch, err := o.Channel()
if err != nil {
log.Printf("%s:%s\n", queue, err.Error())
return

@ -45,6 +45,10 @@ func main() {
mq.SetUpMq()
}
if configs.IsProductionEnv() {
mq.SetUpShaMa()
}
if configs.IsProductionEnv() {
gin.SetMode("release")
} else {
@ -125,6 +129,8 @@ func main() {
if err := h5Server.Shutdown(context.Background()); err != nil {
log.Printf("HTTP server Shutdown: %v", err)
}
_ = mq.Conn.Close()
_ = mq.Conn1.Close()
c.Stop()
close(idleConnClosed)
}()

Loading…
Cancel
Save