Similar to issue mentioned in the thread : https://github.com/streadway/amqp/issues/416
Hi, I am facing the same issue in the above thread with amqp.Dial, if the username or password has "#" symbol, then the split happen at # internally in the Dial code. Can someone please help how to resolve this. I tried even query escape but no luck.
Code inside amqp Dial method : url.Parse splits at # and it is causing the invalidPort error.
func Parse(rawURL string) (*URL, error) {
// Cut off #frag
u, frag := split(rawURL, '#', true)
Below is the code snippet
func connectToRMQServer() {
fmt.Println("Connection staretd ")
rmqurl := "amqp://guest:" + url.QueryEscape("guest#") + "@localhost:5672/"
fmt.Println("rmqurl ", rmqurl)
conn, err := amqp.Dial(rmqurl)
if err != nil {
fmt.Println("Error is ", "Failed to connect to RabbitMQ", err)
return
}
fmt.Println("Connection succesful ", conn)
}
func main() {
fmt.Println("in main")
connectToRMQServer()
}
Similar to issue mentioned in the thread : https://github.com/streadway/amqp/issues/416 Hi, I am facing the same issue in the above thread with amqp.Dial, if the username or password has "#" symbol, then the split happen at # internally in the Dial code. Can someone please help how to resolve this. I tried even query escape but no luck. Code inside amqp Dial method : url.Parse splits at # and it is causing the invalidPort error. func Parse(rawURL string) (*URL, error) { // Cut off #frag u, frag := split(rawURL, '#', true)
Below is the code snippet func connectToRMQServer() { fmt.Println("Connection staretd ") rmqurl := "amqp://guest:" + url.QueryEscape("guest#") + "@localhost:5672/" fmt.Println("rmqurl ", rmqurl) conn, err := amqp.Dial(rmqurl) if err != nil { fmt.Println("Error is ", "Failed to connect to RabbitMQ", err) return } fmt.Println("Connection succesful ", conn) } func main() { fmt.Println("in main") connectToRMQServer() }