2012-11-07 04:01:10 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2012-11-07 04:09:13 +00:00
|
|
|
"flag"
|
2012-11-07 04:58:51 +00:00
|
|
|
"log"
|
2012-11-07 04:01:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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")
|
|
|
|
)
|
|
|
|
|
2012-11-07 04:01:10 +00:00
|
|
|
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)
|
|
|
|
}
|
2012-11-07 04:01:10 +00:00
|
|
|
}
|