var hosts = [{hostname: "alpha.example.com", port: 5672}, {hostname:"beta.example.com", port: 5672}];
var index = -1;
function failover_fn() {
index += 1;
if (index == hosts.length) index = 0;
return {host: hosts[index].hostname, port: hosts[index].port};
};
var opts = {
host: "example.com",
connection_details: failover_fn
}
container.connect(opts);
var hosts = [{hostname: "alpha.example.com", port: 5672}, {hostname:"beta.example.com", port: 5672}];
var index = -1;
function failover_fn() {
index += 1;
if (index == hosts.length) index = 0;
return {host: hosts[index].hostname, port: hosts[index].port};
};
var opts = {
host: "example.com",
connection_details: failover_fn
}
container.connect(opts);
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow