You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
821 B

package sylvilagus
import (
"log"
)
import (
"github.com/streadway/amqp"
)
func CreateHelloTopology(connection *amqp.Connection) (*amqp.Channel, error) {
channel, err := connection.Channel()
if err != nil {
log.Println("Failed to get channel!: ", err)
return nil, err
}
err = channel.ExchangeDeclare("hello-exchange", "direct", true, false, false, false, nil)
if err != nil {
log.Println("Failed to declare exchange!: ", err)
return nil, err
}
_, err = channel.QueueDeclare("hello-queue", false, false, false, false, nil)
if err != nil {
log.Println("Failed to declare queue!: ", err)
return nil, err
}
err = channel.QueueBind("hello-queue", "hola", "hello-exchange", false, nil)
if err != nil {
log.Println("Failed to bind to queue!: ", err)
return nil, err
}
return channel, nil
}