Interface IWorkflowTaskRunner
-
- All Known Implementing Classes:
WorkflowTaskRunner
public interface IWorkflowTaskRunner
Starts the workflow for a givenWorkflowTask
of a project. This task runner is concerned only with running the task, it does not coordinate which task should be run when, and it also does not check whether a task is already being run. Usually you should not use this directly, useIWorkflowEventRunner
to run the tasks of triggers that correspond to a certain event.Note on how tasks are run:
- The task runner receives a list of tasks to run and puts them in a queue. It then removes one item from the queue, executes that item, processes the result, and proceeds with the next item; until the queue is empty.
- Before a task is run, the
precondition
of the task's trigger is checked. When it is not satisfied, the task is skipped. - Workflow nodes may use the
triggerEvent method of the workflow context
to add additional task to the queue. That method also provides an option whether the task should be added to the beginning or end of the queue. These additional tasks are executed once the current task finishes. - When any task throws an unhandled exception, the queue is emptied and remaining tasks are aborted. When the
workflow contains one or more triggers that reacts to a
IUnhandledExceptionEventData
, the corresponding tasks are considered error handlers and are added to the queue. In that case, execution proceeds with these error handling tasks. Otherwise, when there are no such handlers, workflow execution finishes with an exception. - When a task for an error trigger throws an unhandled exception, no further error triggers are fired; and workflow execution finishes with an exception.
- Each trigger handler may define a
onTaskBegin
andonTaskFinish
callback. If they do, the start callback is invoked just before the trigger starts. If that callback throws an error, this is treated as if the task had thrown an error; and the finish callback is skipped. Otherwise, the finish callback is executed after the task was executed, irrespective of whether the task completed successfully. When the finish callback throws an exception, it is treated as if the task had failed.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ITaskQueueExecutionResult
runTasksForEvent(IWorkflowRunTasksForEventParams params)
Executes the given workflow tasks triggered by an event, and returns the result.
-
-
-
Method Detail
-
runTasksForEvent
ITaskQueueExecutionResult runTasksForEvent(IWorkflowRunTasksForEventParams params) throws CouldNotLockFormRecordException
Executes the given workflow tasks triggered by an event, and returns the result. Each task is run to completion, irrespective of whether other tasks have completed successfully or erroneously.If any node throws an unhandled exception, it will be converted to a
WorkflowProcessingException
. This method guarantees that each results in either aITaskExecutionSuccessResult
, or aITaskExecutionErrorResult
.This method creates a new entity context to access the database. Make sure to reread the relevant entities after a call to this method.
- Parameters:
params
- The task to run, and optionally an entity context to use.- Returns:
- The result obtained after the task was executed normally.
- Throws:
CouldNotLockFormRecordException
- When no lock could be acquired on theVorgang
to process. Only one task of a form record can be run at a time.
-
-