node-amqp icon indicating copy to clipboard operation
node-amqp copied to clipboard

authentication failure working with node-amqp library while switching to stomp-client, it works

Open helxsz opened this issue 12 years ago • 3 comments

I am using the node-amqp library to connect to a on-line stomp service, before I was using stomp-client, it was connected very successfully, but it doesn't support auto failure detection and reconnect, so I want to switch to node-amqp for more robust support.

var amqp = require('amqp'); var option = { host: 'host' , port: 61618 , login: 'my username' , password: 'my password' };

var implOpts = { reconnect: true, reconnectBackoffStrategy: 'exponential', reconnectBackoffTime: 500 };

var connection = amqp.createConnection(option,implOpts); connection.addListener('ready', function(){ console.log('ready connection ');

});

connection.on('error', function (error) { console.log('Connection error' ,error);

});

connection.on('close', function () { console.log('Connection close ');

}); the hostname, password, username and port are correct and working in stomp-client library example. However by working with the code above, I got a error saying connection error { message: 'Connection ended: possibly due to an authentication failure.' }. I looked through the code, didn't find any problem about my authentication or and code.

Here is the working code in stomp-client library.

var StompClient = require('stomp-client').StompClient;

var client = new StompClient('host', 61618, 'my username', 'my password', '1.0');

client.connect(function(sessionId) { console.log('Trying to connect the real time service...');

}); could anybody tell me how to work with node-amqp to connect stomp service

helxsz avatar Apr 07 '13 03:04 helxsz

@helxsz @postwait any clues about this. I'm able to run a similar setup successfully on the dev machine but getting this error on production where the mq and app are running on different machines. rabbitmq is default install with no custom config.

ric03uec avatar Jan 21 '14 04:01 ric03uec

never mind. figured it out. Had to modify the ufw rules to not drop the forward requests. Thanks :)

ric03uec avatar Jan 21 '14 06:01 ric03uec

@ric03uec I'm running into the same issue. Could you elaborate on the config changes you made? Thanks!

makebbekus avatar Oct 09 '14 22:10 makebbekus