WorkflowAction

abstract class WorkflowAction<in PropsT, StateT, out OutputT>(source)

An atomic operation that updates the state of a Workflow, and also optionally emits an output.

A WorkflowAction's apply method is executed in the context of an Updater, which provides access to the current props and state, along with a setOutput function. The state can be updated with a new StateT instance that will become the current one after the apply function finishes.

It is possible for one WorkflowAction to delegate to another, although the API is a bit opaque:

val actionA = action {
}

val actionB = action {
  val (newState, outputApplied) = actionA.applyTo(props, state)
  state = newState
  outputApplied.output?.value?.let { setOutput(it) }
}

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
inner class Updater(val props: @UnsafeVariance PropsT, var state: StateT)

The context for calls to WorkflowAction.apply. Allows the action to read and change the state, and to emit an output value.

Functions

Link copied to clipboard

Executes the logic for this action, including any side effects, updating state, and setting the OutputT to emit.

Link copied to clipboard