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

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

Events #

Here's a exhaustive list of workflows events:

Rules #

Rules are stored as documents in the database. Each corresponding to the definition of a rule. They 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.

When creating / deleting a rule, following events are fired. They enable / disable rules executions based on their triggers :

  • workflows:rule:write
  • workflows:rule:delete

If you are using EmbeddedSDK you have to trigger them manually

Example of usage:

Copied to clipboard!
interface EventWorkflowsObjectWrite<
  name extends string = 'rule' | 'workflow',
  TConfigContent extends KDocumentContent = KDocumentContent
> {
  name: `workflows:${name}:write`;

  args: [string, KDocument<TConfigContent>[]];
}

// manual usage example:
app.trigger<EventWorkflowsObjectWrite>(
    `workflows:${initiatorType}:write`,
    index,
    [...documents]
);

Workflows #

Workflows are documents written in a database. They correspond to the definition of a Workflow.

Following events are fired when creating / deleting a workflow. They enable / disable workflows executions based on their triggers :

  • workflows:workflow:write
  • workflows:workflow:delete

If you are using EmbeddedSDK you have to trigger them manually.

Example of usage:

Copied to clipboard!
interface EventWorkflowsObjectDelete<
  name extends string = 'rule' | 'workflow',
  TConfigContent extends KDocumentContent = KDocumentContent
> {
  name: `workflows:${name}:delete`;

  args: [string, KDocument<TConfigContent>[]];
}

// manual usage example : 
app.trigger<EventWorkflowsObjectDelete>(
    `workflows:${initiatorType}:delete`,
    index,
    [...documents]
);

Execution #

A Workflow execution is the process that has been triggered based on workflows/rules triggers. When an error occure during the processing, following event is trigger :

  • workflows:execution:error

Example of usage:

Copied to clipboard!
interface EventWorkflowsExecutionError extends EventDefinition {
  name: "workflows:execution:error";

  args: [
    {
      context: JSONObject;
      error: Error;
    }
  ];
}

// manual usage example:
app.trigger<EventWorkflowsExecutionError>("workflows:execution:error", {
    context,
    error,
});