fix
This commit is contained in:
parent
6188022ad6
commit
e76fe0fead
@ -0,0 +1,26 @@
|
||||
package rabbitmq
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/streadway/amqp"
|
||||
)
|
||||
|
||||
func Open(url string) (*amqp.Connection, *amqp.Channel, error) {
|
||||
conn, err := amqp.Dial(url)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
ch, err := conn.Channel()
|
||||
if err != nil {
|
||||
log.Printf("Failed to open a channel: %v\n", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return conn, ch, nil
|
||||
}
|
||||
|
||||
func Close(conn *amqp.Connection) {
|
||||
conn.Close()
|
||||
}
|
Loading…
Reference in New Issue
Block a user