rest-api/queue/consumer/test_worker.go
Piotr Biernat 27222a479e
All checks were successful
continuous-integration/drone/push Build is passing
Added base RabbitMQ queue support
2020-09-29 23:41:05 +02:00

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!")
}