Official Plugins (Kuzzle v2.x)
Workflows v1.x
2

This plugin is part of the Kuzzle Enterprise Plan. If you are interested, please contact us.

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
  • conditions 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 and actions.

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.

rule-schema

Example: Rule document

Copied to clipboard!
{
  // 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 ],
        ]
      }
    }
  },
  "predicates": [
    {
      "name": "check-new-coordinates"
    }
  ],

  // Actions
  "actions": [
    {
      "type": "task",
      "name": "enrich-payload",
      "args": {
        "areaId": "area-kadikoy"
      }
    }
  ]
}

Metadata #

A Rule contains the following information:

  • name: rule name
  • description: rule description
  • group: group of rules this rule belongs to (optional)
Copied to clipboard!
{
  // 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 we go to the next step: checking the predicates.

If all predicates are checked, then the actions are executed.

Actions #

The following actions are available for rules: