I noticed the folks at
npmjs.org have added a link to
Tonic giving you a browser based sandpit to run your MQ Light Node application in.
Pair this up with the external connectively of the
MQ Light Bluemix service and you have yourself an MQ Light development sandpit without ever having downloaded a thing to your local machine.
Having created an MQ Light Bluemix service and navigated to the service's Service Credentials page. Grab the 'connectionLookupURI' as your MQ Light service parameter and the username and passwords provided there also, pop them into your createClient() request within your MQ Light application and away you go!
As an example (below), throwing together a basic MQ Light application to subscribe to a 'news/technology' and then send a message to itself, we see the application start an MQ Light client, connect, subscribe, send and receive the message and end.
Basic code example:
var mqlight = require("mqlight")
var client = mqlight.createClient({service: '<your service connectionLookupURL here>', user: '<your service credentials username here>', password: '<your service credentials password here>'});
client.on('started', function() {
client.subscribe('news/technology', function(err, pattern) {
if (err) {
console.error('Problem with subscribe request: ', err.message);
} else {
console.log('Subscribed to pattern: ', pattern);
console.log('Sending message : Hello World!');
client.send('news/technology', 'Hello World!');
}
});
client.on('message', function(data, delivery) {
console.log('Got message: ', data);
console.log('Exiting.');
process.exit(0);
});
});
From adding the above code (putting in your particular service's credentials) and clicking "run" the console window below the code shows the expected console log lines:
You can then navigate through the output pages
The MQ Light UI within bluemix shows our client having connected in, and round-tripped our message.
And there you have it. Pretty neat!