This commit is contained in:
shoopea 2019-06-28 15:18:07 +08:00
parent dab2298699
commit 1bea8de9ab

View File

@ -35,15 +35,23 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Session address : %p.\n", &s)
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.Queue, // queue
"", // consumer
true, // auto-ack
q, err := s.MQChannel.QueueDeclare(
s.Queue, // name
false, // durable
false, // delete when unused
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
nil, // arguments
)
m, err := s.MQChannel.Consume(
q.Name, // 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))