コマンド オブジェクトの配列があります。do コマンドを呼び出す必要があります。これは非同期呼び出しであり、各配列要素に対して順番に実行されます。失敗した場合は、処理を停止する必要があります。
個々の非同期呼び出しに対して async.waterfall 呼び出しを行う方法は知っていますが、非同期呼び出しの配列を async.waterfall に渡す方法がわかりません。
構文的に設定方法がわかりません。
これは Command オブジェクトであり、読み取り関数は、ウォーターフォール方式で実行する必要がある非同期呼び出しです...
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]);
});
};