Much better like that, yap
This commit is contained in:
parent
f1c4f20058
commit
46933f0611
@ -26,7 +26,7 @@ func main() {
|
|||||||
log.Fatal("Failed to declare exchange!: ", err)
|
log.Fatal("Failed to declare exchange!: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = channel.QueueDeclare("hello-queue", true, false, false, false, nil)
|
_, err = channel.QueueDeclare("hello-queue", false, false, false, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Failed to declare queue!: ", err)
|
log.Fatal("Failed to declare queue!: ", err)
|
||||||
}
|
}
|
||||||
@ -43,12 +43,17 @@ func main() {
|
|||||||
|
|
||||||
quit := make(chan bool)
|
quit := make(chan bool)
|
||||||
|
|
||||||
go func() {
|
go func(quit chan bool) {
|
||||||
|
log.Println("Consuming...")
|
||||||
for hello := range hellos {
|
for hello := range hellos {
|
||||||
log.Println("hello ->", hello)
|
log.Printf("hello -> %v\n", string(hello.Body))
|
||||||
hello.Ack(false)
|
hello.Ack(false)
|
||||||
|
if string(hello.Body) == "quit" {
|
||||||
|
quit <- true
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}(quit)
|
||||||
|
|
||||||
<-quit
|
<-quit
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user