This commit is contained in:
shoopea 2019-06-28 16:13:25 +08:00
parent ffff09ca65
commit e5ce715442
2 changed files with 7 additions and 2 deletions

6
mq.go
View File

@ -1 +1,7 @@
package main package main
func (c *MQClient) Open() error {
conn, err := amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
c.Connection = conn
return null
}

View File

@ -25,8 +25,7 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
SSL: false, SSL: false,
} }
conn, err := amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path) err := c.Open()
c.Connection = conn
logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Failed to connect to RabbitMQ") logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Failed to connect to RabbitMQ")
if err != nil { if err != nil {