postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

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

Open helxsz opened 11 years ago

helxsz commented 11 years ago

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

ric03uec commented 10 years ago

@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 commented 10 years ago

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

makebbekus commented 10 years ago

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