Rules #
Rules are stored as documents in the database. Each corresponding to the definition of a rule
A rule contains 3 categories of information
- metadata describing the rule
- condition of the rule execution
- actions to be performed if the conditions are met
They are very similar to workflows but they are more limited in terms of conditions.
Rules are used in workflow actions. They allow to define more complex actions than what is achievable by using Tasks, such as geofencing-based document enrichment or state-machines.
Example: Rule document
{
// Metadata
"name": "Geofencing rule Kadikoy",
"description": "Geofencing rule for Kadikoy area",
"group": "geofencing",
// Conditions
"filter": {
"geoPolygon": {
"position": {
"points": [
[ 45.77093, 5.2126366 ],
[ 45.772623, 5.1228726 ],
[ 45.772115, 5.12931 ],
]
}
}
},
// Actions
"actions": [
{
"type": "predicate",
"name": "check-new-coordinates"
},
{
"type": "task",
"name": "enrich-payload",
"args": {
"areaId": "area-kadikoy"
}
}
]
}
Metadata #
A Rule contains the following information:
name
: rule namedescription
: rule descriptiongroup
: group of rules this rule belongs to (optional)
{
// Rule name
"name": "Geofencing rule Kadikoy",
// Rule description
"description": "Geofencing rule for Kadikoy area",
// This rule is part of the "geofencing" rule-group
"group": "geofencing",
}
Conditions #
When a rule is executed in a workflow action, the extracted payload is checked with the rule filters.
This filter is a set of Koncorde filters. If it is valid, then the actions are executed.
Actions #
Rules can execute the same actions as workflows.