Actions
What is it? The activity that a node has to handle is defined using an action. These can have various types, they can be used to specify the communication details for plugins or integrations.
Why it is important? Actions can be used to include business rules in a process, and also to send various data to be displayed in the front-end applications.
The FLOWX.AI platform handles the following types of actions:
- Business Rule
- Save Data
- Kafka Send action
- Websocket Send action
- Validate Field
- Upload File
- Start Subprocess
- Append Params to Parent Process
You can only define and add actions on the following types of nodes: Message send task, Task and User task.
Action rulesโ
Business rules can be attached to a node by using actions with action rules on them. These can be specified using DMN rules, MVEL expressions, or scripts written in Javascript, Python, or Groovy.
ยปSupported scriptsEach button on the user interface corresponds to a manual user action.
Actions can be:
- Manual or automatic
- They can be set as optional or mandatory, if not all mandatory actions are performed on the process node, the flow will not advance
- Actions can also be marked as one-time or repeatable
Some actions can be set to run immediately after another action is performed. In order to achieve this, we need to set the parentName
field on the action to be used as a callback. The callback actions can be performed when a certain message is received by the Engine. In order for this to happen the callbacksForAction
header needs to be set on the message. Callback actions can also be configured to run immediately after the parent action is run, by setting the autoRunChildren
flag to true for the parent action.
Action paramsโ
Action params are used to set extra values for actions. They are stored as key/value pairs. For example, we can set a topic to use for sending outgoing messages or the message format to be sent to the front-end.
The decision that needs to be defined on an exclusive gateway is defined using a node rule. Similar to action rules, these can be set using DMN or MVEL.
There are two possible kinds of actions:
- business logic rules
- interactions with users
Configuring actionsโ
Actions have a few characteristics that need to be set:
- an action can be set as manual or automatic. Manual actions can be executed only through the REST API, this usually means they are triggered by the application user from the interface. Automatic actions are executed without any need for external triggers.
- manual actions can be either mandatory or optional. Automatic actions are all considered mandatory.
- all actions have an order. When there are more actions on a single node, the order needs to be set.
- repeatable - the actions that could be triggered more than once are marked accordingly
- the actions can have a parent/child hierarchy
For more information, check the following section:
ยปAdding an action to a nodeLinking actions togetherโ
There are two ways actions could be linked together, so certain actions can be set to run immediately after others.
Defining callbacksโ
Child actions can be marked as callbacks to be run after a reply from an external system is received. They will need to be set when defining the interaction with the external system (the Kafka send action).
Choosing to automatically run child actionsโ
A parent action has a flag autoRunChildren
, set to false
by default. When this flag is set to true
, the child actions (the ones defined as mandatory and automatic) will be run immediately after the execution of the parent action is finalized.
Scheduling actionsโ
A useful feature for actions is having the ability to set them to run at a future time. Actions can be configured to be run after a period of time, starting from the moment the token triggered them to be executed.