Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message getting Consumed but Subscribe Body isnt getting executed #3

Open
dapinder-dhillon opened this issue Apr 21, 2016 · 0 comments

Comments

@dapinder-dhillon
Copy link

My code is dropping a message on an ActiveMQ queue. Node JS using stomp-client is listening on the queue. But a strange thing is happening, client.subscribe surely getting rid of the message from the queue but some how the callback isnt getting executed.

Please help.

`var http = require('http');
var fs = require('fs');
var Stomp = require('stomp-client');
//JADUQ_DEV
//jms/queue/JaduQ
var destination = 'NODEQ_DEV';
var client = new Stomp('127.0.0.1', 61613);

// Loading socket.io
var io = require('socket.io').listen(server);

client.connect(function(sessionId) {
console.log('CONNECT: '+sessionId);
client.subscribe(destination, function(body, headers) {
console.log('DHILLON');
//console.log('This is the body of a message on the subscribed queue:'+body);
});
console.log('END');
// client.publish(destination, 'Oh herrow');
});

// Loading the index file . html displayed to the client
var server = http.createServer(function(req, res) {
fs.readFile('./index.html', 'utf-8', function(error, content) {
res.writeHead(200, {"Content-Type": "text/html"});
res.end(content);
});
});

io.sockets.on('connection', function (socket) {
socket.emit('message', 'You are connected!');

// When the server receives a 'message' type signal from the client   
socket.on('message', function (message) {
    console.log('A client is speaking to me! TheyӲe saying: ' + message);
});

var interval = setInterval(function() {
    socket.emit('eventDapinder','This is a message from the server!  ' + new Date().getTime());
},5000);

});

server.listen(8090);`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant