Node actions
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?
Node actions allow you to incorporate into a , and send various data to be displayed in front-end applications.
The Flowx.AI platform supports the following types of node actions:
Business rule
Save Data
Kafka send
Send data to user interface
Upload file
Start subprocess
Append params to parent process
You can only define and add actions on the following types of nodes: send message task, task and user task.
Actions fall into two categories:
- Business rules
- User interactions
Business rules
Actions can use action rules such as DMN rules, MVEL expressions, or scripts in JavaScript, Python, or Groovy to attach business rules to a node.
Business rule action
Supported scripts
For more information about supported scripting languages, click on this card.
Action edit
Actions can be:
- Manual or automatic
- Optional or mandatory
If all the mandatory actions are not executed on a node, the flow (token) will not advance.
- Actions can also be marked as one-time or repeatable
Action parameters
Action params store extra values as key/value pairs, like topics for outgoing messages or message formats for the front-end.
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
- allow back to this action - the user can navigate back to this action from a subsequent node
For more information, check the following section:
Adding an action to a node
Linking actions together
There are two ways actions could be linked together, so certain actions can be set to run immediately after others.
Certain actions can run immediately after another action by setting the parentName
field on the action for callbacks. Callback actions are performed when a specific message is received by the Engine, indicated by the callbacksForAction
header in the message. To run actions immediately after the parent action, set the autoRunChildren
flag to true for the parent action.
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.
Callback actions
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).
For example, a callback function might be used to handle a user’s interaction with a web page, such as upload a file. When the user performs the action, the callback function is executed, allowing the web application to respond appropriately.
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).
Example
Callback actions are added in the Advanced configuration tab, in the header param - callbacksForAction
.
callbacksForAction
- the value of this key is a string that specifies a callback action associated with the “upload_file” destination ID. This is part of an event-driven system (Kafka send action) where this callback will be called once the “upload_file” action is completed.
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.
Was this page helpful?