I have an array of command objects. I need to call the do command, this is an asynchronous call, on each of the array elements, in sequence. If any fail, I need to stop processing.
I know how to do the async.waterfall call for individuals async calls but I can not figure out how to pass an array of asynchronous calls to async.waterfall.
Syntactically not sure how to set it up.
this is the Command object and the read function is the asynchronous call I need to do in a waterfall fashion...
var ICommand = require('./command');
function FabricCommand (name) {
this.name = name;
this.fabric = '';
ICommand.call(this);
}
// inherit ICommand
FabricCommand.prototype = new ICommand();
FabricCommand.prototype.read = function () {
var URL = require('url');
var Fabric = require('./rsp_fabrics_port_status_s');
var ResponseVerifier = require('./rsp_mgmt_rsp_s');
var client = require('./soap_client').getInstance();
if (client === null) {
throw new Error('Failed to connect to SOAP server!');
}
var xml = '<urn:mgmtSystemGetInterfaceStatus>' +
'<interface xsi:type=\'xsd:string\'>' + this.name + '</interface>' +
'</urn:mgmtSystemGetInterfaceStatus>';
client.MgmtServer.MgmtServer.mgmtSystemGetInterfaceStatus(xml, function (err, result) {
console.log('got the response from the backend for mgmtSystemGetInterfaceStatus');
if (err) {
throw new Error(err);
}
var rs = new ResponseVerifier(result.rsp);
if (rs.failed()) {
throw new Error(rs.getErrorMessage())
}
this.fabric = new Fabric(result.rsp.portStatus.item[0]);
});
};
From the docs.
Edit
Edit2: