How Amazon MQ service works without asking client to use TrustStore and KeyStore? - jms

When we configure the SSL on standalone ActiveMQ, we may need to provide the TrustStore,TrustStore Password, KeyStore and KeyStore password in client code to connect to the Active MQ over SSL protocol but in case of AmazonMQ, though they have provided SSL endpoint, but we can connect to it simply without providing the trust and key related values.
Client code snippet for Simple ActiveMQ over SSL:
ActiveMQSslConnectionFactory connFactory = new ActiveMQSslConnectionFactory("ssl://<someHost>:61617");
String trustStore = "pathTo/client_new.ts";
String keyStore = "PathTo/client_new.ks";
try {
connFactory.setTrustStore(trustStore);
connFactory.setTrustStorePassword("password");
connFactory.setKeyStore(keyStore);
connFactory.setKeyStorePassword("password");
} catch (Exception e) {
e.printStackTrace();
}
Client code snippet for Amazon MQ over SSL:
ActiveMQConnectionFactory connFactory = new ActiveMQConnectionFactory("ssl://xyz.amazonaws.com:61617");
Basically, what make this difference?

Firstly AmazonMQ works on top of the ActiveMQ, amazon has written a wrapper layer over activeMQ so as functionality wise it works pretty much the same. AmazonMQ is managed Message Broker Service for ActiveMQ.
It manages everything related to space, configuring active/passive endpoints in different regions and some benefits mentioned in the below links.
https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/welcome.html
Other benefits of amazonMQ is you can setup alerts and many more as part of using other services of amazon like upgrading activemq version to the latest.
Now coming to you application part, one good thing was the way you have configured activemq was via SSL connection, though activemq exposes tcp endpoint as well which can be connected by simply providing broker URL but in case of amazonMQ it does not exposes any TCP endpoint only way to connect is by providing SSL endpoint and related parameters.
Refer this link on how application is connected to amazonMQ:
https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-connecting-application.html

Related

Amazon MQ transforming AMQP message to JMS

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?
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.

Spring Stomp websockets with activemq client

I am trying to build a stomp websocket and use amazon activemq service.
it provides 2 url (one in case of failure) and I was wondering if I could use the ActiveMQConnectionFactory to setup the message broker.
so, basically inside DelegatingWebSocketMessageBrokerConfiguration use ActiveMQConnectionFactory to set the client on the stompBroker, instead of or along the ReactorNettyTcpClient.
Basicaly I want to take advantage of the failure recovery url in aws mq.

ActiveMQ support for TLSv1.2

I'm trying to get ActiveMQ to support a TLSv1.2. I'm using activemq v5.14.5. The fix talked about in Create ActiveMQ Connection on TLS1.2 did not work. When I stepped through the code I see that the
context.setSSLContext(sslContext);
SslContext.setCurrentSslContext(context);
Connection connection = factory.createConnection(loginName, pwd);
call to factory.createConnection() actually doesn't use the value that was just set, but instead creates a new SSL context using the hard coded default of "TLS". I observed this in the debugger.
Any other suggestions are welcome. I think the topic "configuring transports" at http://activemq.apache.org/configuring-transports.html may hold the solution but I haven't tried it yet.
The default embedded ActiveMQ broker configuration does not create an SSL transport connector. If you manually added an SSL transport connector, then you may have restricted the SSL protocols supported by the broker using the option transport.enabledProtocols:
<transportConnector name="ssl" uri="ssl://localhost:61617?transport.enabledProtocols=TLSv1.2"></transportConnector>
This configuration restricts the SSL connector of ActiveMQ to only support TLSv1.2. Other TLSv1, TLSv1.1, SSLv3 will not be supported.

Jetty websocket client connect to Stomp.js topic channel

I have written a Spring Websocket server which is assessible from a browser via Stomp.js. I am now attempting to implement a Java client in order to connect my server to a secondary system. I am able to connect to the server using the following code
String destUri = "ws://localhost:8080/sample";
WebSocketClient client = new WebSocketClient();
SimpleEchoSocket socket = new SimpleEchoSocket();
try {
client.start();
URI echoUri = new URI(destUri);
ClientUpgradeRequest request = new ClientUpgradeRequest();
client.connect(socket, echoUri, request);
System.out.printf("Connecting to : %s%n", echoUri);
socket.awaitClose(5, TimeUnit.SECONDS);
} catch (Throwable t) {
t.printStackTrace();
}
The connection is opened, and now I would like to connect to my topic /price-stream. This is achieved by stomp.js :
stompClient.subscribe('/topic/pricechannel1', renderPrice);
what is the equivalent subscribe method for my Jetty websocket client? I cant find anything in the documentation I have found on the net.
Additional info:
I am trying to implement the stockticker example found here into another project. I can connect to the server through the provided Stomp.js interface in a web browser. Now I am attempting to create a Java client for use within a Swing GUI using Jetty websocket-client to connect.
I need to connect to the price stream, but it seems I am missing some kind of configuration request to latch on as a destination for the topic
In general, plain websocket clients (as the one provided by Jetty) support the websocket standard. STOMP is a protocol that sits on top of that transport.
Here, you'd need to implement your own STOMP client or interface an existing one with the websocket client you're using.
Spring 4.2 (to be published soon) includes a new STOMP client for this particular use case. See the reference documentation of 4.2.RC2.

Oracle Service Bus (OSB) Proxy Service Endpoint URI change

We have an OSB Proxy Service which is currently setup to receive messages from an external jms queue endpoint URI. We have been tasked with creating a JMS bridge over which to receive external messages.
To this end, we have created a bridge with local jms in/out queues and proceeded to edit the OSB Proxy Service's Endpoint URI from that of the old external jms queue to that of our new local bridge's jms queue. However, when we try to activate the changes, we get: Exception in AppMerge flows' progression message.
Being quite new to all things OSB, I am unsure as to what this error means and whether re-pointing a Proxy Service's Endpoint URI from remote jms queue to local bridge's jms queue is enough for what we are attempting to do.
Any thoughts on this matter would be much appreciated!
Our OSB version is 10gR3.
Regards,
PM.
I think your Proxy is not deployed correctly. I think after creating the bridge and queues, restart your server and then try to work.

Resources