lightstreamer-jms-client
v1.2.1
Published
This package includes the resources needed to write a client for Lightstreamer JMS Extender.
Downloads
17
Readme
Lightstreamer JMS Extender Client
Use
Install the package using npm
npm install lightstreamer-jms-client
Create a Topic Connection and connect
var ls = require('lightstreamer-jms-client');
ls.TopicConnectionFactory.createTopicConnection("http://localhost:8080/", "HornetQ", null, null, {
onConnectionCreated: function(conn) {
var topicSession= conn.createSession(false, "PRE_ACK");
.....
conn.start();
}
});
Create a Topic Subscription and send it to the server
var topic= topicSession.createTopic("stocksTopic");
var consumer= topicSession.createConsumer(topic, null);
Listen for messages
consumer.setMessageListener({
onMessage: function(message) {
var feedMessage= message.getObject();
var key= feedMessage.itemName;
var values= feedMessage.currentValues;
console.log(values["stock_name"] + ": " + values["last_price"]);
}
});
For further details check the API, the Developer Guide and the available examples