Prerequisites
Installing ACTIVEMQ and Nodejs
Test Steps
1. Execute Bin\win32\activemq.bat Boot MQ service
2. Open http://localhost:8161/admin/topics.jsp
User name and password are admin
3. Download Stomp
npm install stomp-client
4. JS Test Code
var Stomp = require (' stomp-client '); var destination = '/topic/mytopic '; var client = new Stomp (' 127.0.0.1 ', 61613, ' user ', ' Pass '); Client.connect (function (sessionId) { client.subscribe (destination, function (body, headers) { Console.log (' from MQ: ', body); }); Client.publish (destination, ' Hello world! ');});
Execute in Nodejs
5. Open Http://localhost:8161/admin/send.jsp?JMSDestination=myTopic&JMSDestinationType=topic
You'll see a message from Nodejs.
6. Enter a few strings in the text message window of the above page, click Send
You can see the message you just sent in the Nodejs window.
ActiveMQ + NodeJS + Stomp Minimalist Primer