workflows

package
v0.1.0-alpha.57 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package workflows provides the Go-native authoring surface for durable workflows and activities. GoBeyond discovers definitions in the authored workflows/ tree and generates the Temporal registration plumbing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteActivity

func ExecuteActivity(ctx temporalworkflow.Context, definition ActivityDefinition, args ...any) temporalworkflow.Future

ExecuteActivity invokes the definition's handler after applying its compiler-visible options.

func ExecuteActivityReference

func ExecuteActivityReference(ctx temporalworkflow.Context, reference ActivityReference, args ...any) temporalworkflow.Future

ExecuteActivityReference routes an activity call to its definition-owned queue. Generated references make cross-folder calls deterministic.

func ExecuteSubworkflow

func ExecuteSubworkflow(ctx temporalworkflow.Context, reference WorkflowReference, args ...any) temporalworkflow.ChildWorkflowFuture

ExecuteSubworkflow invokes a compiler-generated child reference and always sets its resolved queue. Leaving the native child option empty would incorrectly inherit the parent queue for cross-queue definitions.

func IsActivityContext

func IsActivityContext(ctx context.Context) bool

IsActivityContext reports whether ctx is a Temporal activity context. It is useful to build handlers that retain ordinary context.Context signatures.

func RegisterActivity

func RegisterActivity(registry worker.Registry, definition ActivityDefinition, name string)

RegisterActivity registers a compiler-discovered activity under its stable resolved name.

func RegisterWorkflow

func RegisterWorkflow(registry worker.Registry, definition WorkflowDefinition, name string)

RegisterWorkflow registers a compiler-discovered workflow under its stable resolved name.

func ValidateTaskQueue

func ValidateTaskQueue(queue string) (string, error)

ValidateTaskQueue validates an authored logical queue without accepting a physical environment suffix.

func WithActivity

WithActivity applies a definition's timeouts and, when explicitly authored, routes it to the corresponding physical queue in the current environment. Compiler-generated wrappers use this helper; application workflows may also use it when invoking an imported definition.

Types

type ActivityConfig

type ActivityConfig struct {
	Name                   string
	TaskQueue              string
	StartToCloseTimeout    time.Duration
	ScheduleToCloseTimeout time.Duration
	HeartbeatTimeout       time.Duration
}

ActivityConfig is compiler-visible metadata for an activity definition. An empty TaskQueue inherits the nearest owning workflow queue. A top-level standalone activity with no TaskQueue uses the default queue.

type ActivityDefinition

type ActivityDefinition struct {
	Config  ActivityConfig
	Handler any
}

ActivityDefinition associates metadata with an ordinary Temporal activity function. Authors normally expose one as `var Activity = workflows.DefineActivity(...)`.

func DefineActivity

func DefineActivity(config ActivityConfig, handler any) ActivityDefinition

DefineActivity declares a workflow-owned or standalone activity.

type ActivityReference

type ActivityReference struct {
	Name      string
	TaskQueue string
}

ActivityReference is compiler-generated metadata for an activity that may be invoked without importing its authored package.

type WorkflowConfig

type WorkflowConfig struct {
	Name             string
	TaskQueue        string
	ExecutionTimeout time.Duration
}

WorkflowConfig is compiler-visible metadata for a workflow definition. TaskQueue is a logical queue name such as "orders". Authors never include an environment suffix; the generated worker resolves orders to orders__local (or the active hosted environment).

type WorkflowDefinition

type WorkflowDefinition struct {
	Config  WorkflowConfig
	Handler any
}

WorkflowDefinition associates metadata with an ordinary Temporal workflow function. Authors normally expose one as `var Workflow = workflows.Define(...)`.

func Define

func Define(config WorkflowConfig, handler any) WorkflowDefinition

Define declares a workflow while keeping its handler fully Go-native.

type WorkflowReference

type WorkflowReference struct {
	Name      string
	TaskQueue string
}

WorkflowReference is compiler-generated metadata for a workflow that may be invoked without importing its authored package. TaskQueue is always the definition's fully resolved logical queue, including inherited defaults.

Jump to

Keyboard shortcuts

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