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

View File

@ -88,18 +88,25 @@ func MQKeepAliveWorker() {
} }
//log.Printf("MQKeepAliveWorker : Connected to RabbitMQ") //log.Printf("MQKeepAliveWorker : Connected to RabbitMQ")
log.Printf("MQKeepAliveWorker : Session address : %p.\n", &s) log.Printf("MQKeepAliveWorker : Session address : %p.\n", &s)
/* q, err := s.MQChannel.QueueDeclare(
m, err := s.MQChannel.Consume( s.Queue, // name
s.MQQueue.Name, // queue false, // durable
"", // consumer false, // delete when unused
true, // auto-ack false, // exclusive
false, // exclusive false, // no-wait
false, // no-local nil, // arguments
false, // no-wait
nil, // args )
) m, err := s.MQChannel.Consume(
*/ q.Name, // queue
for d := range s.MQDelivery { "", // consumer
true, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
nil, // args
)
for d := range m {
log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body)) log.Printf("MQKeepAliveWorker : Received a message: %s", string(d.Body))
x := MQKeepAlive{} x := MQKeepAlive{}
err = json.Unmarshal(d.Body, &x) err = json.Unmarshal(d.Body, &x)