temporal

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package temporal provides a lakta module for Temporal workflow orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Instance name
	Name string `koanf:"-"`

	// Target specifies the Temporal server's target address for client connections.
	Target string `koanf:"target"`

	// TaskQueue specifies the Temporal task queue name for workflow and activity execution.
	TaskQueue string `koanf:"task_queue" required:"true"`

	// Namespace defines the Temporal namespace to be used for client and worker operations.
	Namespace string `koanf:"namespace"`

	// Insecure indicates whether transport credentials should be bypassed, enabling an insecure connection.
	Insecure bool `koanf:"insecure"`

	// Credentials specifies the TransportCredentials for secure communication with Temporal services.
	Credentials credentials.TransportCredentials `code_only:"true" koanf:"-"`

	// Registrars holds a list of functions for registering workflows and activities on a Temporal worker.
	Registrars []Registrar `code_only:"WithRegistrar" koanf:"-"`
}

Config holds Temporal client and worker connection settings.

func NewConfig

func NewConfig(options ...Option) Config

NewConfig returns configuration with provided options based on defaults.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns default configuration

func (*Config) ClientOptions

func (c *Config) ClientOptions(logger log.Logger, interceptors []interceptor.ClientInterceptor) client.Options

ClientOptions returns temporal client.Options with config values applied.

func (*Config) DialOptions

func (c *Config) DialOptions() []grpc.DialOption

DialOptions returns grpc.DialOption slice for the temporal client connection.

func (*Config) GetCredentials

func (c *Config) GetCredentials() credentials.TransportCredentials

GetCredentials returns the transport credentials, applying Insecure if set.

func (*Config) LoadFromKoanf

func (c *Config) LoadFromKoanf(k *koanf.Koanf, path string) error

LoadFromKoanf loads configuration from koanf instance at the given path.

func (*Config) WorkerOptions

func (c *Config) WorkerOptions(ctx context.Context, interceptors []interceptor.WorkerInterceptor) worker.Options

WorkerOptions returns temporal worker.Options with config values applied.

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module manages a Temporal client and worker lifecycle.

func NewModule

func NewModule(options ...Option) *Module

NewModule creates a new Temporal module with the given options.

func (*Module) ConfigPath

func (m *Module) ConfigPath() string

ConfigPath returns the koanf path for this module's configuration.

func (*Module) Init

func (m *Module) Init(ctx context.Context) error

Init loads configuration and validates required fields.

func (*Module) LoadConfig

func (m *Module) LoadConfig(k *koanf.Koanf) error

LoadConfig loads configuration from koanf.

func (*Module) Name

func (m *Module) Name() string

Name returns the instance name.

func (*Module) Shutdown

func (m *Module) Shutdown(_ context.Context) error

Shutdown stops the worker and closes the Temporal client.

func (*Module) Start

func (m *Module) Start(ctx context.Context) error

Start connects to Temporal, registers workflows/activities, and runs the worker.

type Option

type Option func(m *Config)

Option configures the Module.

func WithInsecure added in v0.0.2

func WithInsecure(insecure bool) Option

WithInsecure enables or disables insecure transport credentials.

func WithName

func WithName(name string) Option

WithName sets the instance name for this module.

func WithNamespace added in v0.0.2

func WithNamespace(namespace string) Option

WithNamespace sets the Temporal namespace.

func WithRegistrar

func WithRegistrar(registrar Registrar) Option

WithRegistrar adds a workflow/activity registrar (code-only).

func WithTarget added in v0.0.2

func WithTarget(target string) Option

WithTarget sets the target address for the Temporal server.

func WithTaskQueue added in v0.0.2

func WithTaskQueue(queue string) Option

WithTaskQueue sets the Temporal task queue name.

type Registrar

type Registrar func(ctx context.Context, worker worker.Worker) error

Registrar registers workflows and activities on a Temporal worker.

Jump to

Keyboard shortcuts

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