Use of Job Chains
Read more on the features of Job Chain Objects in the order and job chain documentation.
Job Chain Patterns
Forward Dependency Patterns
Job chains represent a sequence of jobs that implements forward dependency.
Job chain with single end nodes for success and failure
- The jobs within the job chain will result in a unique successful end state or otherwise will use the same end state for failure.
- Each job would immediately cause the job chain to be completed in case of error.
Job chain with multiple end nodes for success and failure
- The jobs will use a common end state in case of success and individual end states for failure
- Each job would immediately cause the job chain to be completed in case of error.
Job chain with individual successor nodes
- The jobs are organized in a way that in case of error a job node is skipped an processing is continued with a later job node.
- This sample represents the usage of a job for error handling of previous jobs.
Nested Job Chain Pattern
- Two Job Chains B and C are integrated into a Job Chain A for sequential processing.
- Job Chain A starts Job Chain B and waits for completion.
- Once Job Chain B has terminated then Job Chain A is continued and starts Job Chain C.
- After completion of Job Chain C the processing of Job Chain A is continued.
Parallel Processing Job Chain Pattern
'Split & Sync' or 'Split & Join'
- Two Job Chains B and C are executed in parallel and are controlled by the initiating Job Chain A.
- The initiating Job Chain A splits execution into two Job Chains B and C.
- The execution of Job Chain B and C is synchronized and Job Chain A is continued.
Management of Job Chains
Job chains are created either using the JobScheduler Object Editor (JOE), or using API methods in other programs:
- Firstly you create a job chain and the jobs that are part of this chain. Every position in a job chain is assigned a state and a job.
- An order is then created for the job chain. This is a simple token that is assigned a state in a job chain (normally the beginning of a job chain). Optionally an order has a payload consisting of parameters that are processed by the jobs. When an order is added to the job chain, it is enqueued by JobScheduler according to the state of the order. The job assigned to this position then carries out the order. Additionally, each position in a job chain has a successor state and an error state. JobScheduler changes the state of an order after each job in the job chain has been processed. If the job step was successful, JobScheduler sets the successor state; otherwise it sets the error state.
- The order then moves to another position in the job chain as defined by the new state.
Jobs within a job chain can be executed in multiple processes to handle parallel processing of orders.