29. Workflow Functions
Use the functions below to control the workflow state from APL or to retrieve values from the workflow table.
abort
Stops the workflow, and logs a user defined message to the System Log.
void abort ( string message )
Parameter | Description |
---|---|
| A message (of type error), which is sent to the System Log when the workflow is aborted |
Returns | Nothing |
Note!
The only APL code to be executed after an abort call is the deinitialize
function block.
cancelBatch
Emits a Cancel Batch that aborts the processing of the current batch and possibly continues with the next file (depending on the Workflow Configuration).
void cancelBatch ( string message , drudr errorUDR ) //Optional
Parameter | Description |
---|---|
| A message (of type error), which is logged to the System Log when the batch is cancelled |
| It is possible to send an error UDR containing any useful information to the ECS where the batch is sent (if configured to do so). Note that an error UDR may be defined from the Workflow Properties dialog as well. In this case, the APL code overrules the window configuration. This parameter is optional. |
Returns | Nothing |
dynamicFieldGet
Retrieves the stated dynamic field from the workflow table. The returned value can either be a boolean, an integer, or a string. The fields are configured in the Dynamic Fields tab in the Workflow Properties. See 3.1.8.2 Dynamic Fields Tab in the Desktop User's Guide for further information.
Note!
The APL code will not validate unless the dynamic field(s) has been configured in Workflow Properties.
boolean/int/string dynamicFieldGet ( string category, string name )
Parameter | Description |
---|---|
category | The dynamic field's category |
name | The name of the dynamic field |
Returns | The value of the selected dynamic field |
hintEndBatch
Large input files can be split into smaller output files using hintEndBatch
. The function will send an End Batch message to the other agents in the workflow, possibly causing a split of the current batch being processed. How each agent acts upon such a request can be found out in the respective user's guide; in the Transaction Behavior section. If the workflow does not contain any agent capable of acting upon the request, the workflow will abort.
Note!
The hintEndBatch
() function is only supported for workflows containing one of the following:
Database Collection agent
Disk Collection agent
FTP Collection agent
void hintEndBatch()
Parameter | Description |
---|---|
Returns | Nothing |
Note!
A split batch cannot be sent to ECS. Calling cancelBatch
after hintEndBatch
, will result in workflow abort. However, the original batch can be sent to ECS to make sure to evaluate if the batch will be canceled before it is split.
sleep
Puts the current thread to sleep a given number of milliseconds before resuming execution. This is mostly used for simulation, for instance traffic shaping or limiting number of calls towards an external system.
void sleep ( long milliseconds )
Parameter | Description |
---|---|
| Number of milliseconds the current thread will sleep before resuming execution. |
Returns | Nothing |
wfStop
Stops a running workflow. wfStop
 produces a single stop signal and does not wait for the workflow to stop. If it succeeds in stopping the workflow, the stop is registered in the System Log.
string wfStop ( string wfName , boolean immediate )
Parameter | Description |
---|---|
| The name of the workflow that should be stopped. Note! This command can be used from within the same workflow that should be stopped. |
| True: Stops currently handled batch. False: Runs through currently handled batch and then stops. Note: In a realtime workflow this |
Returns | A string. If the command is successful the value is |
Note!
In ECSAs, the wfStop
command can only stop workflows running on the same container host where the command is applied. Otherwise, the following message is returned: "A workflow by the name <wfName> has not been found."