temporal

package
v0.6.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package temporal is a Temporal client as a dependency: a configuration section, a client traced and measured through the service's OpenTelemetry providers and logging through its logger, a health probe. The SDK's own connection (BACKPLANE_TEMPORAL_*: hooks, activities, workflows) dials through Options too.

For a Temporal of the service's own — another cluster or namespace:

type Config struct {
    config.Backplane `json:"backplane"`
    Billing temporal.Config `json:"billing"` // SHOP_BILLING_ADDR, _NS, ...
}

billing := deps.NewDependency(root, temporal.New(cfg.Billing), deps.Name("billing"))
run, err := billing.Get().ExecuteWorkflow(ctx, opts, "Charge", in)

Index

Constants

View Source
const (
	DefaultNamespace   = "default"
	DefaultDialTimeout = 2 * time.Second
)

Defaults of Config.

Variables

View Source
var ErrNoAddr = errors.New("temporal: addr is required")

ErrNoAddr: the section has no address.

Functions

func New

func New(cfg Config) deps.Provider[Client]

New is the provider of the client: Provide dials, the probe checks the frontend's health, Close closes.

func Options

func Options(cfg Config, identity string, log *xlog.Logger) (client.Options, error)

Options are the client options of cfg: address, namespace, TLS, API key, identity, the logger, OpenTelemetry tracing and metrics.

Types

type Client

type Client = client.Client

Client is the Temporal SDK's client.

func Dial

func Dial(ctx context.Context, cfg Config, opts client.Options) (Client, error)

Dial makes one connection attempt bounded by the dial timeout.

type Config

type Config struct {
	// Addr is the frontend's host:port.
	Addr      string     `desc:"Frontend host:port."    json:"addr,omitempty"`
	Namespace string     `desc:"Temporal namespace."    json:"ns"             schemapb:"default=default"`
	TLS       config.TLS `desc:"TLS of the connection." json:"tls"`
	// APIKey authenticates to Temporal Cloud; it turns TLS on even when TLS
	// is not enabled.
	APIKey config.Secret `desc:"Temporal Cloud API key; turns TLS on." json:"api_key,omitempty"`
	// DialTimeout bounds one connection attempt.
	DialTimeout time.Duration `desc:"Bound of one connection attempt." json:"dial_timeout" schemapb:"default=2s"`
}

Config is the connection's section. Field `ns`: `namespace` is a CEL reserved word.

func (Config) Enabled

func (c Config) Enabled() bool

Enabled reports whether an address is set.

func (Config) Validate

func (c Config) Validate() error

Validate checks what the schema cannot: the address is set and the TLS material parses.

func (Config) WithDefaults

func (c Config) WithDefaults() Config

WithDefaults fills a zero namespace and dial timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL