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 applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution..

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 projectionProjectionA tailored subset of fields on a DataElement designed to encapsulate data for a specific technical or functional view. as presented in the logic layerLayerLogical separation of functionality within a single system/application, focused on code organization..

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 applicationsApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. 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 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</name>
<second>*/10</second>
<minute>*</minute>
<hour>*</hour>
</trigger>

The schedule trigger will use the Eq or Se finderFinderA search specification combining field-operator pairs to execute standard data queries on a DataElement. on the target fieldFieldA property of a DataElement expanded to a database column and user interface input element. by default. To override this the schedule.finder.name option can be added to the transition.

Option
schedule.finder.name Transition

Specify which finderFinderA search specification combining field-operator pairs to execute standard data queries on a DataElement. should be used to retrieve instances when schedules trigger.

<options>
<schedule.finder.name>findByMyCondition</schedule.finder.name>
</options>
Option
schedule.maxFetchSize Transition

Set the maximum number of jobs (elements) which may be fetched in a single schedule trigger. This may be used to limit issues with recurring schedules with a lot of applicable targets.

<options>
<schedule.maxFetchSize/>
</options>
Option
schedule.expression.dynamic Schedule

Allows you to adjust the schedule at runtime before it is executed. This allows you to use a config file or database configuration to change when a schedule is triggered.

<options>
<schedule.expression.dynamic/>
</options>

FieldTimer Trigger​

process-automation-component1.13.0+

process automation TimerJobService Some tasks must happen at a certain date or timestamp. By adding the FieldTimer trigger for a certain Timestamp fieldFieldA property of a DataElement expanded to a database column and user interface input element., the systemSystemA set of interconnected components that work together to achieve a specific purpose or function. will schedule the task to be executed at the timestamp stored in that fieldFieldA property of a DataElement expanded to a database column and user interface input element..

The trigger follows certain rules to keep the trigger up-to-date:

  • A TimerJob is always scheduled after a transition to the beginState is performed.
  • A TimerJob is scheduled on create when the beginState is an initialState.
  • A TimerJob is scheduled on modify when the beginState is equal to the current state.
  • When a TimerJob is scheduled for this workflow on the same element, previous timers are cancelled.
feature

This trigger does require enabling the TimerJobService in order to work. Note that enabling this also requires a database migration!

Option
processAutomation.TimerJob.enable ApplicationApplicationInstance

Enables the expansion of the TimerJob element and the corresponding TimerJobService.

<options>
<processAutomation.TimerJob.enable/>
</options>

Custom Trigger​

The available triggers do not provide a model for any imaginable use case. The custom trigger provides a low bar for extending the systemSystemA set of interconnected components that work together to achieve a specific purpose or function. with your own triggers. It can also be used to simply document the way custom code interacts with the workflow/transition.

When creating expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. for your own type of trigger the custom trigger can be used as a prototype without the need for your own metamodel. You can add a marker option to the custom trigger to indicate your expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. should work here.

When the model for your expanderExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. requires more information than is provided by the custom trigger it is recommended to switch to a metamodel extending the Trigger abstract type.

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 applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. 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.

ProcessAutomation​

Instead of the ConfigureBean the options are directly used in the EngineBean. Additionally, all available settings are configurable on the Workflow element instead of FlowElement. With processAutomation you can only configure waitTime, batchSize and batchTimeout. Further configurations are defined elsewhere such as the Transition.

Options​

Option
flowEngine.workflow.responsible FlowElementComponentApplicationCascading

Configures the responsible fieldFieldA property of a DataElement expanded to a database column and user interface input element. on Workflow.

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

Configures the sequencingStrategy fieldFieldA property of a DataElement expanded to a database column and user interface input element. on EngineService.

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

Configures the waitTime fieldFieldA property of a DataElement expanded to a database column and user interface input element. on EngineService.

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

Configures the timeWindowGroup fieldFieldA property of a DataElement expanded to a database column and user interface input element. on EngineService.

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

Configures the batchSize fieldFieldA property of a DataElement expanded to a database column and user interface input element. on on EngineService.

<options>
<flowEngine.engineService.batchSize>100</flowEngine.engineService.batchSize>
</options>
Option
flowEngine.engineService.batchTimeout WorkflowFlowElement

Configures the BATCH_TIMEOUT fieldFieldA property of a DataElement expanded to a database column and user interface input element. on on EngineService. After the specified timeout (in seconds) the currently active batch will be cancelled if it is still busy. Defaults to 300s.

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

Configures the maximumNumberOfNodes fieldFieldA property of a DataElement expanded to a database column and user interface input element. on EngineService.

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

Configures the implementation fieldFieldA property of a DataElement expanded to a database column and user interface input element. on StateTask.

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

Configures the maxConcurrentTasks fieldFieldA property of a DataElement expanded to a database column and user interface input element. on StateTask.

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

Configures the params fieldFieldA property of a DataElement expanded to a database column and user interface input element. on StateTask.

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

Configures the timeout fieldFieldA property of a DataElement expanded to a database column and user interface input element. on StateTask.

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

Overrides the endState fieldFieldA property of a DataElement expanded to a database column and user interface input element. on StateTask in case of branching tasks. Can be used to optimize a greedy strategy.

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