parent
19e33ee958
commit
a789c2852f
2
def.go
2
def.go
@ -29,7 +29,7 @@ type MQSession struct {
|
|||||||
MQConnection *amqp.Connection
|
MQConnection *amqp.Connection
|
||||||
MQChannel *amqp.Channel
|
MQChannel *amqp.Channel
|
||||||
MQQueue *amqp.Queue
|
MQQueue *amqp.Queue
|
||||||
MQDelivery <-chan *amqp.Delivery
|
MQDelivery <-chan *ampq.Delivery
|
||||||
isConnected bool
|
isConnected bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
mq.go
4
mq.go
@ -8,13 +8,13 @@ import (
|
|||||||
|
|
||||||
func (s MQSession) Open() error {
|
func (s MQSession) Open() error {
|
||||||
if s.isConnected {
|
if s.isConnected {
|
||||||
return errors.New("Session is already connected.")
|
return error.Error("Session is already connected.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if SLL == false {
|
if SLL == false {
|
||||||
s.MQConnection, err = amqp.Dial("amqp://" + Session.User + ":" + Session.Password + "@" + Session.Host + "/" + Session.Path)
|
s.MQConnection, err = amqp.Dial("amqp://" + Session.User + ":" + Session.Password + "@" + Session.Host + "/" + Session.Path)
|
||||||
} else {
|
} else {
|
||||||
return errors.New("SSL connection not implemented")
|
return error.Error("SSL connection not implemented")
|
||||||
}
|
}
|
||||||
logOnError(err, "Open : Failed to connect to RabbitMQ")
|
logOnError(err, "Open : Failed to connect to RabbitMQ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/streadway/amqp"
|
||||||
tb "gopkg.in/tucnak/telebot.v2"
|
tb "gopkg.in/tucnak/telebot.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user