State Task

configuration

A stateTask defines a task that should be executed in a workflow along with the corresponding state transition.

  • name: A descriptive name for the State Task
  • processor: A reference to the target Task Element defined as its component and element name, separated by a colon (:).
  • implementation: The fully qualified java class name of the implementation class for this task. The expanders generate 2 implementation classes by default with postfixes -Impl and -Impl2. If the task has no implementation (because the option includeDelegation was not added), you can enter the value ‘none’.
  • params: Set as ‘default’, unless a Param class is defined for the task element.
  • begin state: The state at which to execute this task
  • interim state: The state which is set during the execution of the task
  • failed state: The state to which the status field is set if the task fails
  • end state: The state to which the status field is set if the task succeeds
  • workflow: An EngineService should be linked to the correct Workflow
  • max concurrent tasks: (since expanders 3.2.0) defines the maximum number of parallel executions that can run in parallel for a given task (see parallelization).
  • timeout: (since expanders 3.2.0) Time (in ms) that a claim for this task remains valid. Should be longer than the expected duration time of the task.

It is possible to have multiple end states by using the option taskElement:isBranchingTask

If the timeout on a claim expires before the task is done, any state modifications by the engine will be rejected and will result in a failed task.

Invoice flow as an Example

Here is an example of a workflow for a fictive ‘Invoice’ element:

Workflow example

In order to model this workflow in an NS application, 3 stateTasks should be defined (1 for each state transition). Each stateTask represents a task that should be executed when an instance of the target element enters the defined begin state.

E.g. for the above flow, the following configuration was used:

name processor implementation params beginState interimState failedState endState workflow maxConcurrentTasks timeout
InvoiceSender tutorialComp:InvoiceSender be.uantwerpen.ee.InvoiceSenderImpl default Initial Sending SendFailed Sent InvoiceFlow 5 60000
InvoicePaymentReceiver tutorialComp:InvoicePaymentReceiver be.uantwerpen.ee.InvoicePaymentReceiverImpl default Sent ReceivingPayment PaymentNotReceived Paid InvoiceFlow 5 60000
InvoiceBooker tutorialComp:InvoiceBooker be.uantwerpen.ee.InvoiceBookerImpl default Paid Booking BookingFailed Booked InvoiceFlow 1 60000

Version

Release Expander version Change
201712 3.2.0 Added fields ‘maxConcurrentTasks’ and ‘timeout’
201905 4.0.1 Allow implementation to contain ‘none’