This commit is contained in:
shoopea 2019-06-28 14:55:02 +08:00
parent 6641b1993b
commit dab2298699

View File

@ -36,18 +36,16 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Queue address : %p.\n", &s.MQQueue)
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Queue name : %s.\n", s.Queue)
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Queue name address : %s.\n", &s.MQQueue.Name)
/*
m, err := s.MQChannel.Consume(
s.MQQueue.Name, // queue
"", // consumer
true, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
)
*/
for d := range s.MQDelivery {
m, err := s.MQChannel.Consume(
s.Queue, // queue
"", // 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))
err = json.Unmarshal(d.Body, &x)
logOnError(err, "MQGetMsgWorker["+strconv.Itoa(id)+"] : Can't unmarshal.\n"+string(d.Body))