temporal

package
v0.0.0-...-593c3ad Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

temporal

Thin factory for creating a configured Temporal client. Used by both the macro workflow runner and the taskflow micro-workflow subsystem.

Usage

import "github.com/OpenNSW/core/temporal"

client, err := temporal.NewClient(temporal.Config{
    Host:      "localhost",
    Port:      7233,
    Namespace: "default",
})
if err != nil {
    log.Fatal(err)
}
defer client.Close()

The returned client.Client is the standard Temporal Go SDK client. Pass it to workflow.NewTemporalManager and taskflow/orchestrator.NewTaskManager.

Config

Field YAML key Type Description
Host host string Temporal server hostname (required)
Port port int Temporal server port, e.g. 7233 (required)
Namespace namespace string Temporal namespace, e.g. "default" (required)

All three fields are required — Validate() rejects an empty Host/Namespace or a Port of 0. There are no implicit defaults; callers must supply explicit values (e.g. 7233 and "default" for local development against temporal server start-dev).

Config carries yaml struct tags, so it can be embedded in a larger application config struct and populated generically (e.g. via yaml.Unmarshal):

temporal:
  host: localhost
  port: 7233
  namespace: default

Local development

Run a local Temporal server with the Temporal CLI:

temporal server start-dev

This starts a server at localhost:7233 in the default namespace with an in-memory store and an embedded UI at http://localhost:8233.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg Config) (client.Client, error)

NewClient creates a shared Temporal client for all workflow runtimes.

Types

type Config

type Config struct {
	Host      string `yaml:"host"`
	Port      int    `yaml:"port"`
	Namespace string `yaml:"namespace"`
}

Config holds configuration required to connect to Temporal.

This is owned by the temporal package (similar to other internal packages), so the package controls the shape/semantics of its configuration.

Host/Port are kept separate to make configuration via environment variables easier and more explicit.

func (Config) Validate

func (c Config) Validate() error

Validate ensures the Temporal configuration is usable.

Jump to

Keyboard shortcuts

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