test
This commit is contained in:
parent
81f17b3ad3
commit
b21e22c59a
13
mq.go
13
mq.go
@ -8,13 +8,18 @@ import (
|
||||
)
|
||||
|
||||
func (s MQSession) Open() error {
|
||||
var err error
|
||||
var (
|
||||
err error
|
||||
conn *amqp.Connection
|
||||
ch *amqp.Channel
|
||||
q *amqp.Queue
|
||||
)
|
||||
if s.isConnected {
|
||||
return errors.New("Session is already connected.")
|
||||
}
|
||||
|
||||
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
|
||||
} else {
|
||||
return errors.New("SSL connection not implemented")
|
||||
@ -24,7 +29,7 @@ func (s MQSession) Open() error {
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
ch, err := s.MQConnection.Channel()
|
||||
ch, err = s.MQConnection.Channel()
|
||||
s.MQChannel = ch
|
||||
logOnError(err, "Open : Failed to open channel")
|
||||
if err != nil {
|
||||
@ -32,7 +37,7 @@ func (s MQSession) Open() error {
|
||||
s.MQConnection.Close()
|
||||
return err
|
||||
}
|
||||
q, err := s.MQChannel.QueueDeclare(
|
||||
q, err = s.MQChannel.QueueDeclare(
|
||||
s.Queue, // name
|
||||
false, // durable
|
||||
false, // delete when unused
|
||||
|
Loading…
Reference in New Issue
Block a user