24 lines
379 B
Go
24 lines
379 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"time"
|
||
|
|
||
|
"github.com/streadway/amqp"
|
||
|
|
||
|
"go-rest-api/queue"
|
||
|
)
|
||
|
|
||
|
// TestWorkerFunc
|
||
|
func main() {
|
||
|
amqp := queue.New()
|
||
|
q := amqp.DeclareQueue("article_queue_test") //failsafe
|
||
|
amqp.Consume(q.Name, callback)
|
||
|
}
|
||
|
|
||
|
func callback(d amqp.Delivery) {
|
||
|
log.Println("Received message: ", string(d.Body))
|
||
|
time.Sleep(5 * time.Second)
|
||
|
log.Println("Finished!")
|
||
|
}
|