box-o-sand/sylvilagus/go/sylvilagus-conntest/main.go

42 lines
582 B
Go
Raw Normal View History

package main
import (
2012-11-07 04:09:13 +00:00
"flag"
"fmt"
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/sylvilagus", "Connection URI for AMQP thingy")
2012-11-07 04:09:13 +00:00
)
func main() {
2012-11-07 04:09:13 +00:00
flag.Parse()
fmt.Printf("Connecting to %v...\n", *connUri)
2012-11-07 04:09:13 +00:00
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)
}
}