cloudamqp / nodejs-amqp-example

Example project showing how to connect to CloudAMQP from Node.js
http://www.cloudamqp.com/
10 stars 17 forks source link

How to pass cluster connection string? #21

Closed nitinsinghit closed 3 years ago

nitinsinghit commented 3 years ago

I am trying var amqp_url = process.env.CLOUDAMQP_URL || ["amqp://admin:admin@172.26.1.2:5672/vhost_test","amqp://admin:admin@172.26.1.2:5672/vhost_test","amqp://user:pass@172.26.2.1:5672/vhost_test"];

dentarg commented 3 years ago

Looks like https://github.com/squaremo/amqp.node only support one server address. If you are not using the CLOUDAMQP_URL environment variable, you can set it like this

var amqp_url = 'amqp://admin:admin@172.26.1.2:5672/vhost_test';
// alternative if you still want to be able to use the environment variable
var amqp_url = process.env.CLOUDAMQP_URL || 'amqp://admin:admin@172.26.1.2:5672/vhost_test';
nitinsinghit commented 3 years ago

Looks like https://github.com/squaremo/amqp.node only support one server address. If you are not using the CLOUDAMQP_URL environment variable, you can set it like this

var amqp_url = 'amqp://admin:admin@172.26.1.2:5672/vhost_test';
// alternative if you still want to be able to use the environment variable
var amqp_url = process.env.CLOUDAMQP_URL || 'amqp://admin:admin@172.26.1.2:5672/vhost_test';

You mean only support single node not cluster?

dentarg commented 3 years ago

You can still use a cluster with multiple nodes, just that the client will only connect to one of the nodes.

nitinsinghit commented 3 years ago

You can still use a cluster with multiple nodes, just that the client will only connect to one of the nodes.

How the connection string looks for multiple nodes? and on failure of one of the node does this library retries to connect to new master?

dentarg commented 3 years ago

There's no connection string for multiple nodes. I don't think it does, you can search the issues or ask at https://github.com/squaremo/amqp.node