Inline Tasks

Infinitic is still in active development. Subscribe here to follow the progress.

As stated previously, workflow's code is processed repeatedly, so it must NOT contain any action with side-effects or whose value changes with time. When this is the case, we must put those actions within a task. For simple actions (as getting a random number or the current date), it can be tedious to do.

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

There is no retry mechanism for inlined tasks, so the inline function should be used only if the lambda can not fail.

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

...
Date now = inline(() -> new Date());
...
...
val now = inline { Date() }
...
Edit this page on GitHub Updated at Fri, May 28, 2021