Creating Chain Definitions with Chain Processes Dependencies
Complex dependencies can be implemented with chain definitions in combination with other repository objects in an intuitive way.
The following different repository objects can be used to create dependencies:
- Locks - Prevent specific processes from running simultaneously.
- Events - process and chains can raise and clear events as well as get submitted by events.
The following chain definition properties allow you to create dependencies:
- Status Handlers - Chain execution can be adapted at runtime by the use of status handlers.
- Precondition function - Allow or disallow chain processes or steps execution based on the output of a function.
Procedure
- Choose "Definitions > Chains" in the Navigation bar.
- Choose New Chain Definition from the context-menu.
- Choose the $fcaJobChainDef; tab and fill in a name for the chain definition, choose Save.
- On the Chain Definition tab, choose the name of the chain definition.
- Choose Add Step from the context-menu, notice that a new step with the caption Step 1 has been added.
- Select Step 1.
- Specify a precondition expression in the Precondition field, an empty Precondition field is evaluated as
true
. - Expand Status Handlers and specify an action to be performed for each desired status.
- Choose Add chain process from the context-menu of Step 1.
- Choose chain process 1 and enter the part of the process definition name into the Process Definition field.
- Choose the desired process definition out of the list of available process definitions.
- Under Scheduling, enter a parameter for Queue.
- Specify a precondition expression in the Precondition.
- Perform actions 6 to 9 of this procedure for each required process.
- Set dependencies:
- On the Locks tab, fill in a name of a desired lock that the chain should hold; specify a
count
is required. - On the Wait Events tab, choose Add and fill the name of an event. Select a value for Auto submit.
- On the Raise Events tab, choose Add and fill the name of an event, specify a Raiser Comment and select a Status To Raise On.
- Choose Save to save the chain definition.
Examples
Using Locks
Two independent chain definitions are not to run simultaneously. Here the default count ( 1
) is used.
Creating a lock.
Choose "Definitions > Locks" in the Navigation bar.
Choose New Lock and fill in a name.
Choose Save and Close.
Attaching the lock to the chain definitions
Choose "Definitions > Chains".
From the context-menu, choose Edit.
Choose the chain definition.
Choose the Locks tab, fill in the name of a previously created lock.
Choose Save and Close.
Using Events
Create an event definition.
Choose "Definitions > Event Definitions" in the Navigation bar.
Choose New Event Definition and fill in a name.
Choose Save and Close.
Attach an event to be raised by the chain definition.
Choose "Definitions > Chains".
From the context-menu, choose Edit.
Choose the chain definition.
Choose the Raise Events tab and choose Add, choose the previously created event.
Choose Save to save the chain definition.
Attach an event to be raised on Wednesdays by process 1 of the first step for status Completed.
Choose "Definitions > Chains".
Choose process 1 of the first step.
Choose Raise Events, choose.
Select an event definition, fill
Wednes
in the Time Window field.Choose Save to save the chain definition.
Attach an event to be raised by process 1 of the first step for status Error only if another event is raised.
Choose "Definitions > Chains".
Choose process 1 of the first step.
Choose Raise Events, choose.
Select an event definition, fill
=Event.isEventRaised('Mypartition.MyEvent')
in the When expression field.Choose Save to save the chain definition.
- Attach an event to submit the chain definition.
- Choose "Definitions > Chains".
- Choose the chain definition.
- Choose the Wait Events tab and choose Add, choose the previously created event definition.
- Choose Save to save the chain definition.
Using Status Handlers
A chain definition with four steps should run step 4 only when one of the three previous steps failed and upon successful completion restart the chain.
When step 4 fails an operator should be informed of the problem.
- Choose "Definitions > Chains".
- From the context-menu, choose Edit.
- Under Error, choose GotoStep and step 4.
- Edit the second step in the same way.
- Choose the third Step, choose the Status Handler tab.
- Under Error, choose GotoStep and step 4.
- Under Completed, choose MarkCompleted.
- Choose the last Step.
- Under Completed, choose RestartChain.
- Under Error, choose RequestRestart.
- Choose Save to save the chain definition.
Using Precondition Functions
The 1st step should only run on Mondays (with time window)
- Choose "Definitions > Chains".
- From the context-menu of the chain definition, choose Edit.
- Choose the first Step.
- Fill
Monday
into the Time Window field and selectSystem_Week_Monday
. - Select is open in the Time Window Status field.
- Choose Save & Close to save the chain definition.
The 1st step should run on Mondays (with an expression)
- Choose "Definitions > Chains".
- From the context-menu of the chain definition, choose Edit.
- Choose the first Step.
- Fill
=Time.isTimeWindowOpen(Time.now('GMT'), 'System_Week_Monday')
. - Choose Save & Close to save the chain definition.
See Also
JobChain