Revert "test"

This reverts commit b21e22c59a.
This commit is contained in:
shoopea 2019-06-28 15:56:14 +08:00
parent 58153cf3d4
commit ac2ae044f6

13
mq.go
View File

@ -8,18 +8,13 @@ import (
) )
func (s MQSession) Open() error { func (s MQSession) Open() error {
var ( var err error
err error
conn *amqp.Connection
ch *amqp.Channel
q *amqp.Queue
)
if s.isConnected { if s.isConnected {
return errors.New("Session is already connected.") return errors.New("Session is already connected.")
} }
if s.SSL == false { if s.SSL == false {
conn, err = amqp.Dial("amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path) conn, err := amqp.Dial("amqp://" + s.User + ":" + s.Password + "@" + s.Host + "/" + s.Path)
s.MQConnection = conn s.MQConnection = conn
} else { } else {
return errors.New("SSL connection not implemented") return errors.New("SSL connection not implemented")
@ -29,7 +24,7 @@ func (s MQSession) Open() error {
s.MQConnection.Close() s.MQConnection.Close()
return err return err
} }
ch, err = s.MQConnection.Channel() ch, err := s.MQConnection.Channel()
s.MQChannel = ch s.MQChannel = ch
logOnError(err, "Open : Failed to open channel") logOnError(err, "Open : Failed to open channel")
if err != nil { if err != nil {
@ -37,7 +32,7 @@ func (s MQSession) Open() error {
s.MQConnection.Close() s.MQConnection.Close()
return err return err
} }
q, err = s.MQChannel.QueueDeclare( q, err := s.MQChannel.QueueDeclare(
s.Queue, // name s.Queue, // name
false, // durable false, // durable
false, // delete when unused false, // delete when unused