42 lines
582 B
Go
42 lines
582 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
)
|
|
|
|
import (
|
|
"github.com/streadway/amqp"
|
|
)
|
|
|
|
var (
|
|
connUri = flag.String("connuri", "amqp://guest:guest@localhost:5672/sylvilagus", "Connection URI for AMQP thingy")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
fmt.Printf("Connecting to %v...\n", *connUri)
|
|
conn, err := amqp.Dial(*connUri)
|
|
defer conn.Close()
|
|
|
|
if err != nil {
|
|
log.Fatal("err:", err)
|
|
}
|
|
|
|
if conn != nil {
|
|
log.Println("conn:", conn)
|
|
}
|
|
|
|
channel, err := conn.Channel()
|
|
|
|
if err != nil {
|
|
log.Fatal("err:", err)
|
|
}
|
|
|
|
if channel != nil {
|
|
log.Println("channel:", channel)
|
|
}
|
|
}
|