Connect to Active MQ with golang
Asked Answered
B

3

7

Amazon MQ (Active MQ) says it works with amqp, and there's a go package here https://github.com/streadway/amqp but when I try to Dial() I get this error

Exception (501) Reason: "Exception (501) Reason: \"frame could not be parsed\""

I suspect it is because although this is an amqp package, and Amazon MQ accepts amqp, this is specifically a RabbitMQ amqp package... does this make sense?

Another option is STOMP, which I've tried using the example here https://github.com/go-stomp/stomp/blob/master/examples/client_test/main.go But Dial() is giving me this super not helpful error: "invalid command"

It's embarrassing asking how to connect, but it's where I'm stuck. Thanks in advance

Breen answered 8/12, 2017 at 0:25 Comment(2)
I am facing the same problem with AmazonMQ and using STOMP. I keep getting "Invalid Command" error. Were you able to resolve it?Pathan
Hi @Bobby, which amqp 1.o client library for go did you use? I have similar requirements and is not able to find anything.Concertino
C
4

AMQP 0.x (RabbitMQ) is a very different protocol from AMQP 1.0 (ActiveMQ, etc). AMQP 1.0 is not backwards compatible.

You need a client library that supports AMQP 1.0.

I have not tested it, but this lib claims to work. https://github.com/vcabbage/amqp

Chauvinism answered 8/12, 2017 at 14:48 Comment(1)
It seems that Microsoft has taken over the maintenance of this project in their fork: github.com/Azure/go-amqpParallax
R
2

You need an AMQP 1.0 client library. The Qpid project at Apache maintains several different language bindings for AMQP 1.0 one of which is a Go client and is documented here and some examples here.

For the STOMP attempt it could be you are not attempting to connect to the correct port on the broker, which can lead to clients giving you that error. The STOMP port is typically 61613, and AMQP is 5672.

Rosemarierosemary answered 8/12, 2017 at 16:7 Comment(2)
Thank you Tim! I'll check this out. In the mean time I wrote my own websocket version by trial/error/reading some java documentation that used stomp. It's super low level, like sending "CONNECT" with two new lines and a null terminator. Just figured out what their side was expecting text wise, and how to split out what I needed from their responses. I hope to get your solution up and running soon!Breen
@bobby-battista GOD! It seems dangerous :)Pallua
C
0

Make sure you are using amqps:// instead of amqp://, as Amazon MQ need a secure connection.

Conformist answered 6/7, 2023 at 17:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.