test
This commit is contained in:
parent
09172c9186
commit
48ff558d59
50
workers.go
50
workers.go
@ -36,32 +36,34 @@ 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(
|
/*
|
||||||
s.Queue, // name
|
q, err := s.MQChannel.QueueDeclare(
|
||||||
false, // durable
|
s.Queue, // name
|
||||||
false, // delete when unused
|
false, // durable
|
||||||
false, // exclusive
|
false, // delete when unused
|
||||||
false, // no-wait
|
false, // exclusive
|
||||||
nil, // arguments
|
false, // no-wait
|
||||||
|
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