Hourglass.Client (hourglass v0.1.0)

Copy Markdown View Source

Client-side workflow operations. Wraps Hourglass.Bridge.client_* NIFs; translates %Bridge.Error{} to higher-level %Error{} reasons.

Summary

Functions

Returns the cluster default namespace as resolved from :hourglass, Hourglass.Client Application config (:namespace), the TEMPORAL_NAMESPACE env var, or "default".

Returns the cluster gRPC target URL from app config / env / default. Public for the same reason as default_namespace/0.

Types

t()

@type t() :: reference()

Functions

await_workflow(client, workflow_handle, opts \\ [])

@spec await_workflow(t(), Hourglass.WorkflowHandle.t(), keyword()) ::
  {:ok, term()} | {:error, Hourglass.Error.t()}

connect(opts \\ [])

@spec connect(keyword()) :: {:ok, t()} | {:error, Hourglass.Error.t()}

default_namespace()

@spec default_namespace() :: String.t()

Returns the cluster default namespace as resolved from :hourglass, Hourglass.Client Application config (:namespace), the TEMPORAL_NAMESPACE env var, or "default".

Public so call sites that build their own gRPC requests outside connect/1 (e.g. Hourglass.BridgeHolder.build_worker_config/2) can share the same source of truth — preventing worker-vs-workflow-namespace skew where one side uses the configured namespace and the other falls back to "default".

default_target_url()

@spec default_target_url() :: String.t()

Returns the cluster gRPC target URL from app config / env / default. Public for the same reason as default_namespace/0.

ensure_namespace(client, name)

@spec ensure_namespace(t(), String.t()) :: :ok | {:error, Hourglass.Error.t()}

fetch_history(client, workflow_id)

@spec fetch_history(t(), String.t()) ::
  {:ok, binary()} | {:error, Hourglass.Error.t()}

health(client)

@spec health(t()) :: :ok | {:error, Hourglass.Error.t()}

start_workflow(client, workflow_module, args, opts)

@spec start_workflow(t(), module(), term(), keyword()) ::
  {:ok, Hourglass.WorkflowHandle.t()} | {:error, Hourglass.Error.t()}