Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to Active MQ with golang

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

like image 999
Bobby Battista Avatar asked Dec 08 '17 00:12

Bobby Battista


2 Answers

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

like image 174
Petter Nordlander Avatar answered Nov 05 '22 11:11

Petter Nordlander


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.

like image 1
Tim Bish Avatar answered Nov 05 '22 10:11

Tim Bish