Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleExample for implementation of JS7Job with JavaScript
linenumberstrue
class JS7Job extends js7.Job {

	processOrder(js7Step) {
    	// do some stuff  
		return;
        // ...
    }
}


Explanation:

  • No specific measures apply. As in any As for every JavaScript function the return statement can be used to leave the processOrder() method prematurely.
  • If the return statement is not used then the job terminates successfully when leaving the processOrder() method.

...

  • JavaScript Jobs can be configured to expect consider a number of return codes that are considered raise warnings.
  • Such Any return codes will not fail the job but will result in a notification if specified with the job configuration.


The implementation of the a job that specifies a return code looks like this:

...

  • The getLogger().warn() method creates log output that qualifies as a warning.
  • The getOutcome().setReturnCode() method is used to specify a return code:
    • Setting the return code in a JavaScript job Job does not raise an error. 
    • Return codes can be checked in a subsequent job or JS7 - If Instruction.
    • If the job configuration specifies one or more Return Codes on Warning and if the job's return code matches one of the values then a notification is created. Otherwise the job will terminate successfully without a warning.
  • For details see JS7 - Job API.

...