TemporalEx.Client (temporal_ex v0.2.1)

Copy Markdown

GenServer that owns the gRPC channel to a Temporal server and provides generic RPC dispatch.

Adding new RPCs never requires changes to this module — callers simply pass the stub function name and a pre-built protobuf request to rpc/4.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the client's configured data converter module.

Returns the client's configured namespace.

Sends an RPC to the Temporal WorkflowService.

Starts a client process linked to the caller.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

data_converter(client)

@spec data_converter(GenServer.server()) :: module()

Returns the client's configured data converter module.

namespace(client)

@spec namespace(GenServer.server()) :: String.t()

Returns the client's configured namespace.

rpc(client, rpc_name, request, opts \\ [])

@spec rpc(GenServer.server(), atom(), struct(), keyword()) ::
  {:ok, struct()} | {:error, term()}

Sends an RPC to the Temporal WorkflowService.

rpc_name must be an atom matching a function on the WorkflowService stub (e.g., :start_workflow_execution).

request is a pre-built protobuf request struct.

Options

  • :namespace — Override the default namespace for this call
  • :timeout — Override the default call timeout

start_link(opts \\ [])

Starts a client process linked to the caller.

Options

  • :target — Temporal server address (default: "localhost:7233")
  • :namespace — Default namespace (default: "default")
  • :api_key — API key or Bearer token for auth
  • :tls — TLS/mTLS config map with keys :client_cert_pem_b64, :client_key_pem_b64, :ca_cert_file
  • :identity — Client identity string
  • :data_converter — Module implementing TemporalEx.DataConverter (default: TemporalEx.DataConverter.Json)
  • :name — GenServer registration name
  • :call_timeout — Default RPC timeout in ms (default: 5000)
  • :connect_retry — Number of gRPC connection retries (default: 0)
  • :adapter_opts — Extra gRPC adapter options