javascript - nodejs + mqlight connection error -
i using nodejs mqlight run sample code provided https://www.npmjs.com/package/mqlight.
i using nodejs 5.5.0 , npm version 3.3.12.
i installed mqlight using
npm install mqlight.
var mqlight = require('mqlight'); var recvclient = mqlight.createclient({service: 'amqp://localhost'}); var topicpattern = 'public'; recvclient.on('started', function() { recvclient.subscribe(topicpattern); recvclient.on('message', function(data, delivery) { console.log('recv: %s', data); }); }); var sendclient = mqlight.createclient({service: 'amqp://localhost'}); var topic = 'public'; sendclient.on('started', function() { sendclient.send(topic, 'hello world!', function (err, data) { console.log('sent: %s', data); sendclient.stop(); }); });
while running above code got below error.
e:\nodejs>node mqtest.js events.js:154 throw er; // unhandled 'error' event ^ networkerror: connection error (localhost:5672): connect failure: remote co mputer refused network connection. @ socket.connerror (e:\nodejs\node_modules\mqlight\mqlight.js:1437:19) @ emitone (events.js:90:13) @ socket.emit (events.js:182:7) @ emiterrornt (net.js:1255:8) @ nexttickcallbackwith2args (node.js:474:9) @ process._tickcallback (node.js:388:17)
please solve problem. using window 7 64 bit os.
are sure service amqp running? can follow below script start amqp service.
start service(system.amqp.service) start channel(system.def.amqp) refresh security type(connauth) display chstatus(system.def.amqp) chltype(amqp)
Comments
Post a Comment