parent
58153cf3d4
commit
ac2ae044f6
13
mq.go
13
mq.go
@ -8,18 +8,13 @@ import (
|
||||
)
|
||||
|
||||
func (s MQSession) Open() error {
|
||||
var (
|
||||
err error
|
||||
conn *amqp.Connection
|
||||
ch *amqp.Channel
|
||||
q *amqp.Queue
|
||||
)
|
||||
var err error
|
||||
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")
|
||||
@ -29,7 +24,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 {
|
||||
@ -37,7 +32,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