chirpnest/mq.go
shoopea 7a7e564029 Revert "test"
This reverts commit 7f3202f35f.
2019-06-28 16:28:04 +08:00

25 lines
394 B
Go

package main
import (
"github.com/streadway/amqp"
)
func (c *MQClient) Open() error {
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
}
c.Channel, err = c.Connection.Channel()
if err != nil {
c.Channel.Close()
c.Connection.Close()
return err
}
return err
}