box-o-sand/sylvilagus/src/meatballhat.com/sylvilagus-conntest/main.go

41 lines
519 B
Go
Raw Normal View History

package main
import (
2012-11-07 04:09:13 +00:00
"flag"
2012-11-07 04:58:51 +00:00
"log"
)
import (
"github.com/streadway/amqp"
)
2012-11-07 04:09:13 +00:00
var (
connUri = flag.String("connuri", "amqp://guest:guest@localhost:5672",
"Connection URI for AMQP thingy")
)
func main() {
2012-11-07 04:09:13 +00:00
flag.Parse()
conn, err := amqp.Dial(*connUri)
2012-11-07 04:58:51 +00:00
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)
}
}