Search code examples
javajsonjmsactivemq-classicstomp

simple active mq java sending to a topic that was created by a stomp javascript


I need to create a very simple active mq code in Java to send one send messages to a particular topic.

I am using active mq from javascript to create a topic and send/recive. This is working fine. It using stomp.

I've been looking for the quickest easiest way to just send messages to an active mq topic using java. Do I need to do any thing with stomp? or can I just send messages. Is tehre any simple example i need to send a json text string but want the simplesest implementation.

thanks


Solution

  • Nothing special needed. You can connect up to ActiveMQ any protocol you'd like. I'd recommend the JMS API/OpenWire protocol approach, since its ActiveMQ's native and OpenWire has the most features. ActiveMQ automatically supports swapping b/w protocols, so it should just work.

    The only tricky thing is mapping destinations. STOMP tends to use "/" and JMS+OpenWire uses "." as a separator. In your Java code use "MY.TOPIC" whereas the STOMP code in JS might be "/topic/MY/TOPIC" for the topic name.