This commit is contained in:
shoopea 2019-06-28 17:12:27 +08:00
parent 4728679b7d
commit 2a98b7e548

View File

@ -13,7 +13,8 @@ import (
tb "gopkg.in/tucnak/telebot.v2" tb "gopkg.in/tucnak/telebot.v2"
) )
func (c *MQClient) Open() error { func Open(c *MQClient) error {
log.Printf("Open : Address of struct : %p\n", c)
var err error var err error
c.Connection, err = amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path) c.Connection, err = amqp.Dial("amqp://" + c.User + ":" + c.Password + "@" + c.Host + "/" + c.Path)
@ -36,14 +37,16 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
//log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Starting.") //log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Starting.")
var x ChatWarsMessage var x ChatWarsMessage
for true { for true {
c := new(MQClient) c := MQClient{
c.User = cfg.Rabbit.User User: cfg.Rabbit.User,
c.Password = cfg.Rabbit.Password Password: cfg.Rabbit.Password,
c.Host = cfg.Rabbit.Host Host: cfg.Rabbit.Host,
c.Path = cfg.Rabbit.Path Path: cfg.Rabbit.Path,
c.SSL = false SSL: false,
}
err := c.Open() log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Address of struct : %p\n", c)
err := c.Open(c)
if err != nil { if err != nil {
q, err := c.Channel.QueueDeclare( q, err := c.Channel.QueueDeclare(