I am new to Stomp ActiveMQ. I want to create a login from an android client and I don't know how to use ActiveMq. I\ve installed active mq, configured stomp and run the stompexample.
1. I have an error when running activemq from command line if I add in in the activemq.xml the following line:
<transportConnector name="stomp+nio" uri="stomp+nio://localhost:61612"/>
<transportConnector name="stomp+ssl" uri="stomp+ssl://localhost:61612"/>
Can someone please explain what is with tx1 and tx2? Is there a way to send on the queue a message to a specific client? how?
connection.connect("system", "manager");
connection.begin("tx1");
connection.send("/queue/test", "message1");
connection.send("/queue/test", "message2");
connection.commit("tx1");
connection.subscribe("/queue/test", Subscribe.AckModeValues.CLIENT);
connection.begin("tx2");
StompFrame message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2");
message = connection.receive();
System.out.println(message.getBody());
connection.ack(message, "tx2");
connection.commit("tx2");
connection.disconnect();
Can someone please tell me how to create an application that sends on a queue a text containing username, password and receives an answer if the register was successful?
You need to configure the transport connectors with different port numbers, they can't both share port 61612. Your configure is create a Stomp NIO connector and a different Stomp SSL Connector.
You can't send messages to a distinct client, you just place them on a Queue and if there is a client subscribed it will get the message, that's the nature of Queue based messaging. The TX1 TX2 stuff is sending the messages within a transaction.
Recommend you take some time to read up of JMS Messaging, the Stomp spec and some other messaging based tutorials.
Related
I have a requirement to create a bridge between a Queue in ActiveMQ and a Queue in Solace. When ever there is a message in ActiveMQ Queue it should automatically get transferred to SolaceQ.
I'm struggling to find the steps for this configuration. I have ActiveMQ installed on my local machine. Request you to please throw some light on this.
FYI: I'm very new to ActiveMQ/Solace
I think you'll need to do this via JMS since both ActiveMQ and Solace support it. Check out ActiveMQ's docs here: https://activemq.apache.org/jms-to-jms-bridge
EDIT2: My issue here was caused by an insufficient understanding of how transport connectors work in ActiveMQ. TL;DR is that ActiveMQ will implicitly "transform" or "relay" messages between your transport connector configurations defined in activemq.xml.
EDIT: Additional info, the STOMP messages received by the Angular application are used for debugging and demo purposes. Hence, simply converting the OpenWire message to a blob of readable text is sufficient.
I'm creating an Angular application (preferably website, avoiding native applications), which objective is to "tap in" by web sockets on an ActiveMQ server and subscribe to OpenWire messages. How do I let ActiveMQ transform OpenWire messages to STOMP messages and send these to any clients (i.e. my Angular application) connected to the ActiveMQ WebSocket connector?
In addtiion, it would be nice-to-have if I could transform STOMP to OpenWire as well.
It must be Angular
Avoiding the use of native applications on the client-side is preferable although not a deal-breaker.
Adding extra processing stress on the ActiveMQ server must be done with caution.
To the best of my knowledge, it is only possible to let Angular "talk directly" with the ActiveMQ server by STOMP messages send by web socket, if I am to avoid using native applications.
I already have an Angular application capable of STOMP communication by web sockets (e.g. something like https://github.com/stomp-js/ng2-stompjs-angular7).
I am missing information on how to configure the ActiveMQ server to transform OpenWire-->STOMP through its transport connectors.
In my understanding, what I am trying to do should be possible. It is noted by other users but not how. E.g. users hint that what I want is possible in ActiveMQ but not Apollo: ActiveMQ to Apollo transition, Openwire to Stomp protocol configuration.
I expect (preferably) the need to use something like an ActiveMQ transformer (e.g. adding transformer to the connector configuration: AMQP & Openwire - Activemq broker and 2 different consumers) or maybe writing an ActiveMQ plugin (http://activemq.apache.org/developing-plugins.html). On ActiveMQ's website, an existing transformer is mentioned (http://activemq.apache.org/stomp.html Message Transformations section):
Currently, ActiveMQ comes with a transformer that can transform XML/JSON text to Java objects
... but no mention of how to use this and I am unsure if I can benefit from this and if this means that there are no transformers for OpenWire-->STOMP or vice versa.
I expect I might have misunderstood some of the concepts, and a "you're going in a wrong direction, do this instead" can work out as a good answer for me. At the time of writing, I expect I will have to create an ActiveMQ plugin using their Message Transformer interface (http://activemq.apache.org/message-transformation.html) although their sub links are 404. I hope to achieve a more simple solution, e.g. an existing OpenWire-->STOMP transformer:
<transportConnector name="openwire" uri="{some-openwire-uri}?transport.transformer=stomp"/>
ActiveMQ will "transform" any Openwire message into a STOMP message and vice versa as needed based on client connections. I an Openwire based JMS client connects and places a message onto a queue and a STOMP based client comes along and subscribes to that queue the message will be converted into a STOMP message to send to that client.
Without knowing more about what issue you are having it is hard to provide more insight than that though. There are some cases where the transformation from Openwire to STOMP might not yield exactly the right thing for you such as a MapMessage or StreamMessage and definitely an ObjectMessage so some care needs to be taken about cross protocol messaging.
You do of course need to add a transport connector for each of the protocols you want to support, Openwire, STOMP, AMQP etc. The clients need something to connect to, then once they connect the broker manages the message transformations amongst subscriptions on Topics and Queues.
I am trying to create a Subscriber in my Spring Boot Application. My objective is that the publisher will send multiple messages to a topic and I have to get those message and process them .I noticed that the "handleMessage" of both Paho and Apache ActiveMq will process 1 message at a time. Is it possible to make it concurrent??
I have tried the following
Replaced Paho with ActiveMq
Provided concurrency in my listenercontainer
Provided prefetch in my subscribe URL
Please let me know if there is any way to make my MQTT subscriber to take multiple messages concurrently.
Thank You
If you supply your own thread pool you can have the handleMessage method pass the incoming message off to the threadpool to process and then pass the next message off to the pool.
I try to send message to multiple queues according this documentation ActiveMQ Wildcards. The idea is to send message to PRICE.> queue and receive them in queues PRICE.STOCK.NASDAQ.ORCL and PRICE.STOCK.NYSE.IBM (queues are created). But instead of forwarding messages to PRICE.STOCK.NASDAQ.ORCL and PRICE.STOCK.NYSE.IBM activemq create new queue PRICE.> that become this message.
I tried to send message with activemq admin tool (send mask) and spring boot application. Behavior is the same - message is placed in new created queue PRICE.>.Activemq was not additionally configured, I'm using configuration provided with activemq 5.15.7.
The feature is only supported for subscribers, you need to send to a specific named destination when publishing a message. You can use the Virtual Destinations feature of ActiveMQ to define a target destination that forwards to some defined set.
I have a requirement to load messages from two queues and i am using ActiveMQ I have to implement the Retry mechanism in case of any error or network or application server failure and load back into the same Queue. Also, I want to load any poison messages to DLQ.
Please let me know if I can acheive these through Spring JMS. Also, please advise some good examples to accomplish this task. I checked Spring JMS documentation and have not much details in that.
This is a broker function with ActiveMQ - just configure the broker with the appropriate policies.
If using a DefaultMessageListenerContainer, you must use transacted sessions; then, if the listener throws an exception the message will be rolled back onto the queue and the broker's retry/DLQ policies kick in.
See the Spring documentation about enabling transactions.