Inline Tasks

As stated previously, workflow's code is processed multiple times, so it should not contain non-deterministic instructions either any instruction with side effects. When this is the case, we must put those within a task. For simple instructions (as getting a random number or the current date), it can be tedious to do so.

The inline function provides an easy way to "inline" such a task. The provided lambda is processed by the workflow worker only the first time. After that, the returned value will be found directly from the workflow history.

Inline tasks should be used only for instructions that can not fail.

For example, we can use the current date in a workflow like this:

Inline task

Typical use cases of inline tasks are:

  • using environment variables
  • using current date
  • using random values
  • logging

New version 0.11.2!