Executes the command. Before execution it validates args using the defined schema. The command execution intercepts exceptions raised by the called function and returns them as an error in callback.
(optional) transaction id to trace execution through call chain.
the parameters (arguments) to pass to this command for execution.
function to be called when command is complete
Gets the command name.
the name of this command.
Validates the command args before execution using the defined schema.
the parameters (arguments) to validate using this command's schema.
an array of ValidationResults or an empty array (if no schema is set).
Generated using TypeDoc
Concrete implementation of ICommand interface. Command allows to call a method or function using Command pattern.
Example
let command = new Command("add", null, (correlationId, args, callback) => { let param1 = args.getAsFloat("param1"); let param2 = args.getAsFloat("param2"); let result = param1 + param2; callback(null, result); }); command.execute( "123", Parameters.fromTuples( "param1", 2, "param2", 2 ), (err, result) => { if (err) console.error(err); else console.log("2 + 2 = " + result); } ); // Console output: 2 + 2 = 4
ICommand
CommandSet