The taskSequencer implements the 'sequencing' of tasks. This feature, configured by selecting sequencing strategy 'greedy', takes one instance and tries to execute tasks until it has reached a stable end state. The sequencing is executed in a single thread of the TaskProcessor. So multiple instances can be sequenced simultaneously. The maximum number of tasks that can be sequenced concurrently is defined by the first StateTask that is executed (dependent on the beginState of the instance). When used of a workflow, it is best to keep the maxConcurrentTasks values the same for all stateTasks in the workflow.
The implementation uses a sorted list of stateTasks (see StateTask sorting), which prevent the flow from being caught in a loop.
The implementations have been added to the workflow component with the classes 'DefaultTaskSequencer' and 'GreedyTaskSequencer'. The workflow instance as defined in the EngineService can be configured with 'sequencingStrategy' field. The current possibe values are:
- default this will execute the first stateTasks and no more
- greedy this will iterate through all stateTasks and attempt to execute the task if the current state is equal to the beginState of that stateTask
TaskSequencer attempts to run all tasks necessary to get an instance to its final state: