Versions Compared

Key

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

Table of Contents

Introduction

Assume Consider the following scenario:

  • A number of jobs are executed in sequence.
  • If one or more jobs fail with return code 1 then the jobs should be repeated for a number of times. For any other non-zero return codes the order should be put to a failed state and should wait for user intervention , - for example, to resume or to cancel the failed order.
  • A related scenario is available from in the JS7 - How to retry a job in case of specific exit codes article.

Solution

The workflow presented below implements the use case using the following instructions:

...

  • This workflow implements:
    • an outer Retry Block to repeat execution,
    • an inner Try / Catch Block to handle return codes of the job ,and
    • an If Instruction to decide about the handling of specific return codes.

...

  • After a first job job1, job2 should be restarted for a number of times if it fails with return code 1.
  • The JS7 - Retry Instruction manages the retry capability and the intervals.
    • The properties of the Retry Instruction include either specifying a common delay for any retries or using individual delays for each retry.
  • The JS7 - Try-Catch Instruction 
    • executes any number of instructions and jobs within the Try Block.:
      • if If the jobs complete successfully then processing will continue after the Catch Block.
      • if If jobs fail then the instructions and jobs inside the Catch Block will be executed.

...

The Catch Block is executed in case the event of failed instructions or jobs in a Try Block.

...

In this scenario the job is configured to consider any non-zero return code as signaling failure. This requires use of a Try / Catch Instruction to handle errors.

...

  • the JS7 - Task History classifies the job being as having failed,
  • a notification is will be created for each failed execution that which is visible from the the JS7 - Monitor view and that which can be forwarded by a JS7 - NotificationNotifications.

These implications might reflect what some users need. For an alternative solution that does not fail the offending job and that does not create notifications see see the JS7 - How to retry a job in case of specific exit codes article.