Amazon MQ transforming AMQP message to JMS
Asked Answered
I

1

8

I have a Python and Java Spring application communicating 2 ways. The stack is mostly built on Java/Spring so ActiveMQ and JMS were the logical choices. However, we added a Python application that needed to interact with the rest of the services so I used qpid proton (AMQP library) and added the following configuration inside the ActiveMQ configuration to get it working:

<transportConnectors>
    <transportConnector name="openwire" uri="ssl://0.0.0.0:61617?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="amqps" uri="amqp+ssl://0.0.0.0:5671?maximumConnections=1000&wireFormat.maxFrameSize=104857600&transport.transformer=jms"/>
</transportConnectors>

which worked flawlessly on ActiveMQ and allowed to send/receive JMS TextMessage with an AMQP client.

Unfortunately, Amazon MQ refused this configuration and returned the following error:

The value 'amqp+ssl' of attribute 'name' on element 'transportConnector' is not valid with respect to its type, 'protocol'. and cvc-enumeration-valid: Value 'amqps' is not facet-valid with respect to enumeration '[openwire]'

AWS markets Amazon MQ as a managed ActiveMQ service but they seem to be lacking in functionalities since the mapping from AMQP to JMS has been available since version 5.8: https://activemq.apache.org/amqp and the Amazon MQ broker that I'm using is at version 5.15.12

I have tried adding the amp;transport.transformer=jms and transport.transformer=jms headers to the query string of the broker's URL, as well as using STOMP as the protocol (since it is a plain-text protocol) in the Python app instead of AMQP but none of these worked.

So, do you know any potential missing configurations or other ways I could send an AMQP message in my Python app and receive a JMS TextMessage in the Java app?

Irreverence answered 22/9, 2020 at 0:24 Comment(3)
Does it work if you just enable AMQPS? Amazon's documentation says they support AMQPS but, to be fair, they don't say the support multiple protocols. It just looks like a bug in Amazon's tooling to me. It might be quicker just to install the "real" ActiveMQ on a bare VM ;)Circuit
AMPQS is already the default. The core issue seems to be that AmazonMQ doesn't support setting these properties for transportConnector => docs.aws.amazon.com/amazon-mq/latest/developer-guide/…. I think OP is looking for client-side solution, or a workaround to work without it.Gavingavini
Did you find a solution to this issue? I also see the similar issues trying to send Byte arrays from NodeJs + AMQP lambdas to consumers using Java + JMS.Dorothi
S
0

By default in the open source ActiveMQ 5.x code the AMQP transport already defaults to the JMS transformation so unless the Amazon version has altered that you shouldn't need to even set that explicitly if you want JMS transforms of the inbound AMQP messages. If they've altered that then you'd need to contact them to determine how to change that configuration.

Sendai answered 22/9, 2020 at 18:31 Comment(2)
Indeed as said here activemq.apache.org/amqp.html the default behaviour is the native transformation that to wraps the AMQP content into a JMS BytesMessage. This is much harder to process for the receiver because it includes the headers and properties at the start of the payload, so upon receiving the message, I have to figure out where the content starts which is easy when you look at it but hard to put into code in a generic way. Previously, when the transformer was set to jms, there was no headers/properties inside the message content.Irreverence
In that case I'd recommend trying ActiveMQ Artemis which has a much more polished AMQP protocol stack implemented and is actively maintained.Sendai

© 2022 - 2024 — McMap. All rights reserved.