Temporalex.Backend behaviour (Temporalex v0.3.1)

Copy Markdown View Source

Server-facing backend boundary.

Backends deliver decoded core structs to Temporalex.Server and accept core completions from it. Backend-specific transport, protobuf, native resources, and worker handles must stay behind this behaviour.

Summary

Types

state()

@type state() :: term()

Callbacks

complete_activity_task(state, t)

@callback complete_activity_task(
  state(),
  Temporalex.Core.ActivityCompletion.t()
) :: :ok | {:error, term()}

complete_workflow_activation(state, t)

@callback complete_workflow_activation(
  state(),
  Temporalex.Core.Completion.t()
) :: :ok | {:error, term()}

record_activity_heartbeat(state, task_token, details)

@callback record_activity_heartbeat(
  state(),
  task_token :: binary(),
  details :: term()
) :: :ok | {:error, term()}

shutdown_worker(state)

@callback shutdown_worker(state()) :: :ok | {:error, term()}

start_worker(opts, owner_pid)

@callback start_worker(opts :: keyword(), owner_pid :: pid()) ::
  {:ok, state()} | {:error, term()}