parent
866ec809c6
commit
d0f5426c12
23
workers.go
23
workers.go
@ -32,16 +32,8 @@ func MQGetMsgWorker(id int, msgs chan<- ChatWarsMessage) {
|
||||
err = s.Open()
|
||||
}
|
||||
log.Printf("MQGetMsgWorker[" + strconv.Itoa(id) + "] : Connected to RabbitMQ")
|
||||
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 m {
|
||||
|
||||
for d := range s.MQDelivery {
|
||||
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))
|
||||
@ -360,16 +352,7 @@ func MQKeepAliveWorker() {
|
||||
time.Sleep(15 * time.Second)
|
||||
err = s.Open()
|
||||
}
|
||||
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 m {
|
||||
for d := range s.MQDelivery {
|
||||
log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body))
|
||||
x := MQKeepAlive{}
|
||||
err = json.Unmarshal(d.Body, &x)
|
||||
|
Loading…
Reference in New Issue
Block a user