-
Notifications
You must be signed in to change notification settings - Fork 213
Variable tagging
IMPORTANT: This Kogito wiki is deprecated. For the latest Kogito documentation, see the Kogito documentation page. To contribute to Kogito documentation, see the
master-kogito
branch of thekie-docs
repository in GitHub.
Variable tagging allows developers to hint Kogito for extra behaviour to a specific process variable. Tags can be used by Kogito during the code generation phase or at runtime. Tags are simple String values that are added as metadata to a specific variable. A process instance variable can have multiple tags associated with it, although you might need to consider the implications of using certain tags. For instance, tagging a variable as internal and required is not recommended. By default, Kogito runtime supports a few out-of-the-box tags, but you’re not limited to those. You can also create your own.
Note
|
If a process variable has no tag assigned to it, Kogito will consider it as having both tags: input and output. |
-
internal - A process variable tagged as internal is not exposed in the REST model and is considered an internal variable. For instance, you can use intermediate variables that help hold some state during the execution of the process but are not part of the domain.
-
required - A process variable tagged as required, instructs the Kogito engine that once starting a new instance, this variable must be supplied. Otherwise, a VariableViolationException is thrown.
-
readonly - A process variable tagged as readonly, can only be set once during the process instance execution. If at any time, there is an attempt to change its value, a VariableViolationException is thrown.
-
input - A process variable tagged as input, instructs the Kogito engine that this variable should not be exposed in the return data model. That means, for instance, that the value of a given variable would not be seen in the return data via REST.
-
output - A process variable tagged as output, instructs the Kogito engine that this variable should be used as output and thus not expecting it on starting and will be included in the returned data model.
-
business-relevant - A process variable tagged as business-relevant, marks a tag as a value that is somehow relevant for business. This can be useful for monitoring purpose, or giving a hint for another application that this variable is relevant. This information will, along with other variables, be visible for use in a Process event listener.
-
tracked - A process variable tagged as tracked, instructs the Kogito runtime to emit events any time there is a change in the value of this variable. Events are published to topic kogito-variables-events, where you can get access to the previous and new value. For more information on how to publish these events, please visit Kogito runtime events
As a developer, you can add any String as a tag for a process instance variable. Although it does not affect the Kogito execution, it allows that this information is then available via Process event listeners.