Revert "test"

This reverts commit 002c547a50.
This commit is contained in:
shoopea 2019-06-28 15:56:29 +08:00
parent 866ec809c6
commit d0f5426c12

View File

@ -32,16 +32,8 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
err = s.Open() err = s.Open()
} }
log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Connected to RabbitMQ") log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Connected to RabbitMQ")
m, err := s.MQChannel.Consume(
s.MQQueue.Name, // queue for d := range s.MQDelivery {
"", // consumer
true, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
)
for d := range m {
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Received a message: %s", string(d.Body)) log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Received a message: %s", string(d.Body))
err = json.Unmarshal(d.Body, &x) err = json.Unmarshal(d.Body, &x)
logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Can't unmarshal.\n"+string(d.Body)) logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Can't unmarshal.\n"+string(d.Body))
@ -360,16 +352,7 @@ func MQKeepAliveWorker() {
time.Sleep(15 * time.Second) time.Sleep(15 * time.Second)
err = s.Open() err = s.Open()
} }
m, err := s.MQChannel.Consume( for d := range s.MQDelivery {
s.MQQueue.Name, // queue
"", // consumer
true, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
)
for d := range m {
log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body)) log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body))
x := MQKeepAlive{} x := MQKeepAlive{}
err = json.Unmarshal(d.Body, &x) err = json.Unmarshal(d.Body, &x)