TemporalEx.ScheduleHandle (temporal_ex v0.2.1)

Copy Markdown

A handle to a Temporal Schedule.

Carries the client reference, schedule ID, and namespace so that callers never need to pass the client or IDs again after obtaining a handle from TemporalEx.create_schedule/3 or TemporalEx.get_schedule_handle/2.

Summary

Functions

Deletes the schedule.

Describes the schedule, returning its spec, action, policies, state, and info.

Patches the schedule to pause, unpause, trigger immediately, or backfill.

Pauses the schedule.

Triggers the schedule to run immediately.

Unpauses the schedule.

Updates the schedule with a new definition.

Types

t()

@type t() :: %TemporalEx.ScheduleHandle{
  client: GenServer.server(),
  namespace: String.t() | nil,
  schedule_id: String.t()
}

Functions

delete(handle, opts \\ [])

@spec delete(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Deletes the schedule.

Options

  • :identity — Caller identity

describe(handle, opts \\ [])

@spec describe(
  t(),
  keyword()
) :: {:ok, struct()} | {:error, TemporalEx.Error.t()}

Describes the schedule, returning its spec, action, policies, state, and info.

Examples

{:ok, description} = TemporalEx.ScheduleHandle.describe(handle)

patch(handle, opts \\ [])

@spec patch(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Patches the schedule to pause, unpause, trigger immediately, or backfill.

Options

  • :pause — String note to pause with
  • :unpause — String note to unpause with
  • :trigger_immediatelytrue or keyword list with :overlap_policy
  • :backfill — List of [start_time: DateTime, end_time: DateTime, overlap_policy: atom]
  • :identity — Caller identity
  • :request_id — Idempotency key

pause(handle, opts \\ [])

@spec pause(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Pauses the schedule.

Options

  • :note — Note to record on the schedule (default "paused").
  • Any option accepted by patch/2 (:identity, :request_id, :timeout).

Examples

:ok = TemporalEx.ScheduleHandle.pause(handle)
:ok = TemporalEx.ScheduleHandle.pause(handle, note: "Pausing for maintenance")
:ok = TemporalEx.ScheduleHandle.pause(handle, note: "Pausing", identity: "ops")

trigger(handle, opts \\ [])

@spec trigger(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Triggers the schedule to run immediately.

Options

  • :overlap_policy — Override overlap policy for this trigger

unpause(handle, opts \\ [])

@spec unpause(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Unpauses the schedule.

Options

  • :note — Note to record on the schedule (default "unpaused").
  • Any option accepted by patch/2 (:identity, :request_id, :timeout).

Examples

:ok = TemporalEx.ScheduleHandle.unpause(handle)
:ok = TemporalEx.ScheduleHandle.unpause(handle, note: "Resuming after maintenance")
:ok = TemporalEx.ScheduleHandle.unpause(handle, identity: "ops")

update(handle, opts \\ [])

@spec update(
  t(),
  keyword()
) :: :ok | {:error, TemporalEx.Error.t()}

Updates the schedule with a new definition.

Options

  • :schedule — Schedule definition keyword list (same format as TemporalEx.create_schedule/3)
  • :conflict_token — Conflict token from a previous describe (for optimistic locking)
  • :identity — Caller identity
  • :request_id — Idempotency key
  • :search_attributes — Map of search attribute fields. Omit (or pass nil) to leave existing attributes untouched. Pass %{} to clear all attributes.
  • :memo — Map of memo fields. Omit (or pass nil) to leave existing memo untouched. Pass %{} to clear all memo fields.