parent
ff8aa3b34d
commit
67fc40e7aa
50
workers.go
50
workers.go
@ -36,34 +36,32 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
|
|||||||
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Connection address : %p.\n", &s.MQConnection)
|
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Connection address : %p.\n", &s.MQConnection)
|
||||||
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Channel address : %p.\n", &s.MQChannel)
|
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Channel address : %p.\n", &s.MQChannel)
|
||||||
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Queue name : %s.\n", s.Queue)
|
log.Printf("MQGetMsgWorker["+strconv.Itoa(id)+"] : Queue name : %s.\n", s.Queue)
|
||||||
/*
|
q, err := s.MQChannel.QueueDeclare(
|
||||||
q, err := s.MQChannel.QueueDeclare(
|
s.Queue, // name
|
||||||
s.Queue, // name
|
false, // durable
|
||||||
false, // durable
|
false, // delete when unused
|
||||||
false, // delete when unused
|
false, // exclusive
|
||||||
false, // exclusive
|
false, // no-wait
|
||||||
false, // no-wait
|
nil, // arguments
|
||||||
nil, // arguments
|
|
||||||
|
|
||||||
)
|
)
|
||||||
m, err := s.MQChannel.Consume(
|
m, err := s.MQChannel.Consume(
|
||||||
q.Name, // queue
|
q.Name, // queue
|
||||||
"", // consumer
|
"", // consumer
|
||||||
true, // auto-ack
|
true, // auto-ack
|
||||||
false, // exclusive
|
false, // exclusive
|
||||||
false, // no-local
|
false, // no-local
|
||||||
false, // no-wait
|
false, // no-wait
|
||||||
nil, // args
|
nil, // args
|
||||||
)
|
)
|
||||||
for d := range m {
|
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))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
msgs <- x
|
msgs <- x
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
}
|
||||||
log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Closing queue.\n")
|
log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Closing queue.\n")
|
||||||
s.Close()
|
s.Close()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user