This commit is contained in:
shoopea 2019-06-28 16:25:37 +08:00
parent 4a0618dcf5
commit f73b77e097

7
mq.go
View File

@ -5,16 +5,15 @@ import (
)
func (c *MQClient) Open() error {
conn, err := amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
c.Connection = conn
var err error
c.Connection, err = amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
if err != nil {
c.Connection.Close()
return err
}
ch, err := c.Connection.Channel()
c.Channel = ch
c.Channel, err = c.Connection.Channel()
if err != nil {
c.Channel.Close()
c.Connection.Close()