You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Introduction

Assume the following scenario:

  • A number of jobs are executed in sequence.
  • If a specific job fails with exit code 1 then it should be repeated for a number of times. For any other non-zero exit 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.

The implementation makes use of the following instructions:

Workflow

The below workflow implements the use case.

Download: retry-on-return-code.workflow.json


Explanation:

  • This workflow implements
    • an outer Retry Block to repeat execution.
    • an inner Try / Catch Block to handle specific exit codes of the job.

Try Block


Explanation:

  • After a first job job1 the 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.
  • JS7 - Try / Catch Instruction 
    • executes the job within the Try Block.
      • Should the job complete successfully then processing will continue after the Catch Block.
      • Should the job fail then it will enter the Catch Block.

Catch Block

If Instruction


Explanation:

  • Within the Catch Block the JS7 - If Instruction is used to check the return code value which gives two options:
  • If the return code is 1 then left branch of the If Instructions used for any other return code values the right branch is used.
  • Subsequently we find two occurrences of a JS7 - Fail Instruction.

Fail Instruction

Left Fail


Explanation:

  • The left Fail Instruction fails the order with a return code 1.
  • In addition, a message can be added that becomes visible with the JOC Cockpit GUI for the failed order.
  • As a consequence the failed order is picked up by the outer Retry Instruction that will repeat execution of job1.

Right Fail


Explanation:

  • The right Fail Instruction fails the order with a return code 2.
  • In addition, a message can be added that becomes visible with the JOC Cockpit GUI for the failed order.
  • The checkbox uncatchable is used to indicate that the failed order cannot be picked by the outer Retry Instruction and therefore will remain with the current position in a failed state.



  • No labels