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 ¶
- func ExecuteActivity(ctx temporalworkflow.Context, definition ActivityDefinition, args ...any) temporalworkflow.Future
- func ExecuteActivityReference(ctx temporalworkflow.Context, reference ActivityReference, args ...any) temporalworkflow.Future
- func ExecuteSubworkflow(ctx temporalworkflow.Context, reference WorkflowReference, args ...any) temporalworkflow.ChildWorkflowFuture
- func IsActivityContext(ctx context.Context) bool
- func RegisterActivity(registry worker.Registry, definition ActivityDefinition, name string)
- func RegisterWorkflow(registry worker.Registry, definition WorkflowDefinition, name string)
- func ValidateTaskQueue(queue string) (string, error)
- func WithActivity(ctx temporalworkflow.Context, definition ActivityDefinition) temporalworkflow.Context
- type ActivityConfig
- type ActivityDefinition
- type ActivityReference
- type WorkflowConfig
- type WorkflowDefinition
- type WorkflowReference
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 ¶
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 ¶
ValidateTaskQueue validates an authored logical queue without accepting a physical environment suffix.
func WithActivity ¶
func WithActivity(ctx temporalworkflow.Context, definition ActivityDefinition) temporalworkflow.Context
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 ¶
ActivityReference is compiler-generated metadata for an activity that may be invoked without importing its authored package.
type WorkflowConfig ¶
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 ¶
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.