Skip to main content

Triggers

The concept of triggers is introduced to have fine-grained control over the transitions in the workflow state-machine. Each transition can have a number of triggers, depending on the needs of your application.

CRUD Triggers

process automation Two crud-action triggers are supported currently; OnCreate and OnModify. The OnCreate will only trigger once for a dataElement when it is created through its logic Bean. The OnModify on the other hand will trigger every time an element is modified through the logic Bean. The event information will contain the Details projection as presented in the logic layer.

Transition Trigger

process automation The OnTransition triggers for every element which is transitioned by the process automation component. It is primarily useful for a sequence of tasks which are executed autonomously.

DataCommand Trigger

process automation It is common for applications to transition based on a user action or other external source. The ByDataCommand trigger makes it easy to trigger (a set of) transitions through a command. Define a command on the target element with hasTargetInstance=true. This command can now be used as the target of the trigger, and will expand the required implementation. Two options are defined on the DataCommand to customize behavior.

Option
workflow.trigger.button DataCommand

Adds a button to the (knockout) UI to perform this command. The button will only be visible in valid begin-states.

<options>
<workflow.trigger.button/>
</options>
Option
workflow.trigger.blockingMs DataCommand

When defined, the command will perform linked transitions in a blocking manner. The until_complete option value indicates no timeout, while a positive integer indicates a timeout (in ms) for the transition to complete.

<options>
<workflow.trigger.blockingMs>until_complete</workflow.trigger.blockingMs>
</options>
<options>
<workflow.trigger.blockingMs>500</workflow.trigger.blockingMs>
</options>

Schedule Trigger

process automation have long been missing from our applications. The Schedule trigger allows for defining a schedule using a cron-like syntax for each transition. The main difference with cron is that we also support a 'seconds' and 'year' property.

The following trigger configurations show some examples of what is possible with a schedule.

<trigger type="Workflows::Schedule" name="Every10Seconds">
<second>*/10</second>
<minute>*</minute>
<hour>*</hour>
</trigger>

FlowEngine Trigger

Adding the FlowEngine trigger indicates the transition should be picked up by a FlowEngineBean. It corresponds directly to a StateTask element in the database configuration. Each workflow in the model which has a linked FlowElement also expands a <Workflow>ConfigureBean which will manage the available StateTasks in the database on startup. Any changes to the model will simply be persisted when a new version of the application is deployed. This means you no longer have to manually configure your database for the workflows when using the metamodel.

The database configuration has a lot of options, as documented here. In order to maintain compatability each of these options can be represented in the model as well.

Options

Option
flowEngine.workflow.responsible FlowElementComponentApplicationCascading

Configures the responsible field on Workflow.

<options>
<flowEngine.workflow.responsible>workflow</flowEngine.workflow.responsible>
</options>
Option
flowEngine.engineService.sequencingStrategy FlowElement

Configures the sequencingStrategy field on EngineService.

<options>
<flowEngine.engineService.sequencingStrategy>greedy</flowEngine.engineService.sequencingStrategy>
</options>
Option
flowEngine.engineService.waitTime FlowElementComponentApplicationCascading

Configures the waitTime field on EngineService.

<options>
<flowEngine.engineService.waitTime>5</flowEngine.engineService.waitTime>
</options>
Option
flowEngine.engineService.timeWindowGroup FlowElement

Configures the timeWindowGroup field on EngineService.

<options>
<flowEngine.engineService.timeWindowGroup>daytime</flowEngine.engineService.timeWindowGroup>
</options>
Option
flowEngine.engineService.batchSize FlowElement

Configures the batchSize field on on EngineService.

<options>
<flowEngine.engineService.batchSize>100</flowEngine.engineService.batchSize>
</options>
Option
flowEngine.engineService.maximumNumberOfNodes FlowElement

Configures the maximumNumberOfNodes field on EngineService.

<options>
<flowEngine.engineService.maximumNumberOfNodes>1</flowEngine.engineService.maximumNumberOfNodes>
</options>
Option
flowEngine.stateTask.implementation FlowEngine

Configures the implementation field on StateTask.

<options>
<flowEngine.stateTask.implementation>net.democritus.TaskImpl</flowEngine.stateTask.implementation>
</options>
Option
flowEngine.stateTask.maxConcurrentTasks FlowEngine

Configures the maxConcurrentTasks field on StateTask.

<options>
<flowEngine.stateTask.maxConcurrentTasks>16</flowEngine.stateTask.maxConcurrentTasks>
</options>
Option
flowEngine.stateTask.params FlowEngine

Configures the params field on StateTask.

<options>
<flowEngine.stateTask.params/>
</options>
Option
flowEngine.stateTask.timeout FlowEngine

Configures the timeout field on StateTask.

<options>
<flowEngine.stateTask.timeout>600</flowEngine.stateTask.timeout>
</options>
Option
flowEngine.stateTask.endState FlowEngine

Overrides the endState field on StateTask in case of branching tasks. Can be used to optimize a greedy strategy.

<options>
<flowEngine.stateTask.endState>EndState</flowEngine.stateTask.endState>
</options>