# Process file

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

It is structured in the following way:

Name Type Description
name string Name of the process.
steps Step[] Steps to execute.

# Steps

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

  • Trigger: an event or a task's result 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 or a task's result is emitted.
  • 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.
  • Filter: stop the execution of the process if a condition doesn't match.
    • A process can have as many filters as you want.
    • Filters are optional.

# Example

Here is an example of typical process.

name: erc20-notification
steps:
  - type: trigger
    instance:
      src: https://github.com/mesg-foundation/service-ethereum-erc20
      env:
        - PROVIDER_ENDPOINT=$(env:PROVIDER_ENDPOINT)
    eventKey: transfer
  - type: task
    instanceHash: "H74Qqq8nT5JZ9GSJmuSWLN5benWZPkUb5pYcvQLsoZX"
    taskKey: taskY
    inputs:
      inputA: "Input1 to the task"
      # or
      inputB:
        stepKey: taskX
        key: taskZ
  - type: filter
    conditions:
      contractAddress: "0x420167d87d35c3a249b32ef6225872fbd9ab85d2"
  - type: task
    instance:
      src: ./convert
    taskKey: email
  - type: task
    instance:
      src: https://github.com/mesg-foundation/service-email-sendgrid
      env:
        - SENDGRID_API_KEY=$(env:SENDGRID_API_KEY)
    taskKey: send

# 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 variable that you can override while running the compile command with the flag --env XXXX=value.