Implementing the producer side and breaking out common topology bits
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
import (
|
||||
"github.com/streadway/amqp"
|
||||
"meatballhat.com/sylvilagus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -16,24 +17,9 @@ func main() {
|
||||
|
||||
defer connection.Close()
|
||||
|
||||
channel, err := connection.Channel()
|
||||
channel, err := sylvilagus.CreateHelloTopology(connection)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to get channel!: ", err)
|
||||
}
|
||||
|
||||
err = channel.ExchangeDeclare("hello-exchange", "direct", true, false, false, false, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to declare exchange!: ", err)
|
||||
}
|
||||
|
||||
_, err = channel.QueueDeclare("hello-queue", false, false, false, false, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to declare queue!: ", err)
|
||||
}
|
||||
|
||||
err = channel.QueueBind("hello-queue", "hola", "hello-exchange", false, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Failed to bind to queue!: ", err)
|
||||
log.Fatal("Failed to build topology!: ", err)
|
||||
}
|
||||
|
||||
hellos, err := channel.Consume("hello-queue", "hello-consumer", false, false, false, false, nil)
|
||||
|
Reference in New Issue
Block a user