Warm tip: This article is reproduced from stackoverflow.com, please click
activemq java rabbitmq amazon-mq

Does RabbitMQ really work with Amazon MQ (ActiveMQ)?

发布于 2020-04-15 10:49:56

I've got a Java RabbitMQ producer application, and I want to send some messages on ActiveMQ from Amazon MQ (I've created the broker). I follow the step from this page.

I made the Java example for RabbitMQ, at first it seems fine but when I create the connection to my Endpoint (username and password too): amqps://x-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-x.xx.xx-xxxx-x.amazonaws.com:5671

in this line:

factory.newConnection();

I've got these error:

Error in the internal library:

[AMQP Connection xx.xx.xx.xx:5671] ERROR com.rabbitmq.client.impl.ForgivingExceptionHandler - An unexpected connection driver error occured
com.rabbitmq.client.MalformedFrameException: AMQP protocol version mismatch; we are version 0-9-1, server sent signature 3,1,0,0
    at com.rabbitmq.client.impl.Frame.protocolVersionMismatch(Frame.java:170)
    at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:107)
    at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:184)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:645)
    at java.lang.Thread.run(Thread.java:745)

Error I've caught up:

null com.rabbitmq.client.ShutdownSignalException: connection error

I understand the principal error was the mismatch version, but is there a way to fix it by changing the version protocol or it is not possible?

Because RabbitMQ uses AMQP 0-9 in the example.

Questioner
CarlosS
Viewed
73
Justin Bertram 2020-02-04 10:44

ActiveMQ (both 5.x "classic" and Artemis) supports AMQP 1.0. If the RabbitMQ client speaks AMQP 1.0 then it should work. If it doesn't, then it won't.

The documentation you cited doesn't indicate that the RabbitMQ client will work with ActiveMQ. It just demonstrates common uses of the RabbitMQ client and then provides alternate JMS examples. In the "Conclusion" section the article states:

In this post, I reviewed how to get started with an Amazon MQ broker and walked you through several code examples that explored the differences between RabbitMQ and Apache ActiveMQ client integrations. If you are considering migrating to Amazon MQ, these examples should help you understand the changes that might be required.

In other words, you'll have to change your application. You can't use the RabbitMQ client with ActiveMQ.