# Process definition

A process is a YAML file that describes the connections between events and tasks of services with a step-by-step system.

It is structured in the following way:

Key Type Description
name String Name of the process
steps Step[] Steps to execute (trigger, filter or task)

A process has a list of steps. Each step indicates a specific action to do. There is three types of steps:

# trigger Trigger

An event that will trigger the process.

  • Should be the first step of the process.
  • Only one trigger is possible per process.
  • It triggers the process when a matching event is emitted.

Triggers available:

# task Task

Defines the task to execute of a given instance of a service.

  • A process should have at least one task and can have as many as you want.

Tasks available:

# filter Filter

Stop the execution of the process if a condition doesn't match. Apply one or multiple conditions on the previous step's outputs. All conditions should match to continue to the next step.

  • A process can have as many filters as you want.
  • Filters are optional.
Key Type Description
type "filter"
conditions map<string, Value> Key-value map where the key references a data of the previous step's outputs and the value is the expected matching value

The simplest way to set conditions is to use a map<string, Value> where the key references a data of the previous step's outputs and the value is the expected matching value.

The condition value can be any of the following types:

  • string
  • bool
  • number

# Example

- type: filter
  conditions:
    previousTaskOutput_1: "hello" # the value of this output must be "hello"
    previousTaskOutput_2: 10 # the value of this output must be 10
    previousTaskOutput_3: true # the value of this output must be true

Advanced filter

You can create advanced filters with different predicate and references. Check out the filter documentation.

# Example

Here is an example of typical process.

name: hello-world
steps:
  - type: trigger
    endpointKey: helloWorld
  - type: task
    handler: ./hello-world.js

Environmental variable

You can override any value in the process file during the compilation by using the following syntax:

$(env:XXXX)

Where XXXX is the name of the environmental variable defined in your .env file or given with a flag on the process:dev command.