-
-
Save hodbn/5b8fe5242a5e46e1c635108a21ffe869 to your computer and use it in GitHub Desktop.
AMQPlain repro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module github.com/hodbn/gist | |
go 1.16 | |
require github.com/streadway/amqp v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"os" | |
"time" | |
amqplib "github.com/streadway/amqp" | |
) | |
func main() { | |
var conn *amqplib.Connection | |
c := amqplib.Config{ | |
Heartbeat: 10 * time.Second, | |
Locale: "en_US", | |
} | |
c.SASL = []amqplib.Authentication{&amqplib.AMQPlainAuth{ | |
Username: os.Args[1], | |
Password: os.Args[2], | |
}} | |
conn, err := amqplib.DialConfig(os.Args[3], c) | |
if err != nil { | |
log.Printf("can't dial: %v", err) | |
} else { | |
log.Println("works") | |
} | |
conn.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment