LetsFlow
  • Introduction
  • Tutorial
    • The basics
    • A handshake
    • A conversation
    • A proper introduction
    • Group meeting
    • Quote
  • Cookbook
  • ENGINE
    • Installation
    • Authentication
    • API
    • Services
      • Configuration
      • Messaging
        • ZeroMQ
        • AMQP 0-9-1
        • Webhook
      • Engine service
  • Integration
    • Frontend
      • React
      • Angular
      • Vue
      • Svelte
    • Backend
  • Reference
    • Scenario
      • Actor
      • Action
        • Update instruction
      • State
        • Transition
          • Log
        • Notify
      • Data function
    • Schema
    • Process
      • Current state
      • Previous log
      • Prediction
      • Events
        • Instantiate event
        • Action event
        • Timeout event
  • Libraries
    • Core library
    • JMESPath
    • Test suite
      • Given
      • When
      • Then
        • Assert state
        • Assert actor
        • Assert variable
        • Assert service
        • Assert event
      • Customize
  • Advanced topics
    • Deep integration
    • Decentralized workflows
    • Custom JMESPath functions
    • Custom YAML tags
Powered by GitBook
On this page
  • Action transitions
  • Timeout transitions
  • Properties
  • on
  • by
  • after
  • goto
  • if
  • log

Was this helpful?

  1. Reference
  2. Scenario
  3. State

Transition

A transition defines the change from one state to the next.

Action transitions

Typically a state transition is triggered after an action is executed. Action transtitions have an on property that specifies the action that triggers the transition.

Optionally they can have a by property to specify which actors can trigger the transitions. Multiple transitions can have the same action but with different actors.

Action transitions are evaluated in order. If multiple transitions apply, only the first one is used.

initial:
  transitions:
    - on: join
      goto: ~
    - on: start
      by: organizer
      goto: start
      if: !ref length(actors) >= 2
    - on: cancel
      by: organizer
      goto: (canceled)
{
  "initial": {
    "transitions": [
      {
        "on": "join",
        "by": "participant",
        "goto": null
      },
      {
        "on": "join",
        "by": "organizer",
        "goto": "start",
        "if": { "<ref>": "length(actors) >= 2" }
      },
      {
        "on": "cancel",
        "by": "organizer",
        "goto": "(canceled)"
      }
    ]
  }
}

Timeout transitions

Alternatively, state transitions can happen after a specific time. In this case, the transition has after property instead of on.

If multiple timeout transitions are available, the one with the lowest value for after will be used.

initial:
  after: 10 days
  goto: (expired)
{
  "initial": {
    "after": "10 days",
    "goto": "(expired)"
  }
}

If a state transition uses goto: ~, the process stays in the same state and the time for a timeout is not reset. In cases goto contains the name of the current state, the time is reset.

Properties

on

string

Key of the action that must be performed for this transition to be selected.

by

string or array of string

The key of an actor or multiple actors as an array. Only select this transition if the action is performed by this actor / one of these actors.

after

time

A time after which the transition should be executed. If you specify a timeout using after do not use the on and by property.

The time should be in the form of 'amount unit' in English, eg '10 minutes', '12 hours`, or `1 week`.

goto

string

The key of the state where to transition to.

if

log

log definition

Defines the title and description of the log entry added during a state transition.

PreviousStateNextLog

Last updated 2 months ago

Was this helpful?

boolean or

A boolean that must be true for the transition to be selected. This is typically a <ref> .

function
data instruction
Log