Jidoka.Workflow.Background (Jidoka v0.9.0)

Copy Markdown View Source

Runs durable declarative workflows in the background.

This module is the Jidoka use-case facade. A private adapter owns the Runic process and event-store details.

Summary

Functions

Waits for one background run to reach a terminal or recoverable state.

Returns a child specification for a named background workflow runner.

Returns portable events for one background run.

Returns the current public run view by stable ID.

Restarts one recoverable background run from stored events.

Starts a supervised background workflow runner.

Stops one background run and keeps its persisted events.

Submits a declarative workflow and returns its stable run ID.

Types

runner()

@type runner() :: atom()

Functions

await(runner, run_id, opts \\ [])

@spec await(runner(), String.t(), keyword()) ::
  {:ok, Jidoka.Workflow.Run.t()} | {:error, term()}

Waits for one background run to reach a terminal or recoverable state.

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Returns a child specification for a named background workflow runner.

events(runner, run_id)

@spec events(runner(), String.t()) ::
  {:ok, [Jidoka.Workflow.RunEvent.t()]} | {:error, term()}

Returns portable events for one background run.

get(runner, run_id)

@spec get(runner(), String.t()) :: {:ok, Jidoka.Workflow.Run.t()} | {:error, term()}

Returns the current public run view by stable ID.

recover(runner, run_id, opts \\ [])

@spec recover(runner(), String.t(), keyword()) :: {:ok, String.t()} | {:error, term()}

Restarts one recoverable background run from stored events.

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()

Starts a supervised background workflow runner.

stop(runner, run_id)

@spec stop(runner(), String.t()) :: :ok | {:error, term()}

Stops one background run and keeps its persisted events.

submit(runner, workflow_module, input, opts \\ [])

@spec submit(runner(), module(), map() | keyword(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

Submits a declarative workflow and returns its stable run ID.