Documentation
¶
Overview ¶
Package function provides Temporal workflow activities for dispatching arbitrary Go functions.
It implements the workflow.TaskInput and workflow.TaskOutput interfaces with function-specific payload types and uses a Registry to map function names to their implementations at runtime. Registered functions are executed as Temporal activities and can be composed using the generic orchestration patterns in the workflow package (pipeline, parallel, loop, DAG).
Index ¶
- func RegisterActivity(w worker.Worker, activityFn interface{})
- func RegisterAll(w worker.Worker, activityFn interface{})
- func RegisterWorkflows(w worker.Worker)
- func SetActivityInstrumenter(wrapper func(activityType) activityType)
- type DAGWorkflowInput
- type DataMapping
- type FunctionDAGNode
- type FunctionDAGWorkflowOutput
- type FunctionExecutionInput
- type FunctionExecutionOutput
- type FunctionInput
- type FunctionInputMapping
- type FunctionNodeResult
- type FunctionOutput
- type Handler
- type LoopInput
- type LoopOutput
- type OutputMapping
- type ParallelInput
- type ParallelOutput
- type ParameterizedLoopInput
- type PipelineInput
- type PipelineOutput
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterActivity ¶
RegisterActivity registers a function execution activity with a worker. Create the activity with activity.NewExecuteFunctionActivity(registry). Calling this function multiple times on the same worker is a no-op for subsequent calls — the activity type is registered at most once per worker.
func RegisterAll ¶
RegisterAll registers all function workflows and the given activity with a worker. Create the activity with activity.NewExecuteFunctionActivity(registry). Calling this function multiple times on the same worker is a no-op for subsequent calls — idempotency is ensured via job.RegisterWorkflowOnce and job.RegisterActivityOnce.
func RegisterWorkflows ¶
RegisterWorkflows registers all function workflows with a worker. Calling this function multiple times on the same worker is a no-op for subsequent calls — each workflow type is registered at most once per worker.
func SetActivityInstrumenter ¶ added in v1.7.0
func SetActivityInstrumenter(wrapper func(activityType) activityType)
SetActivityInstrumenter sets the function that wraps activities with instrumentation. This must only be called once during initialization; subsequent calls are ignored.
Types ¶
type DAGWorkflowInput ¶ added in v1.16.0
type DAGWorkflowInput = payload.DAGWorkflowInput
Type aliases for extended (DAG) types re-exported from function/payload.
type DataMapping ¶ added in v1.16.0
type DataMapping = payload.DataMapping
Type aliases for extended (DAG) types re-exported from function/payload.
type FunctionDAGNode ¶ added in v1.16.0
type FunctionDAGNode = payload.FunctionDAGNode
Type aliases for extended (DAG) types re-exported from function/payload.
type FunctionDAGWorkflowOutput ¶ added in v1.16.0
type FunctionDAGWorkflowOutput = payload.FunctionDAGWorkflowOutput
Type aliases for extended (DAG) types re-exported from function/payload.
type FunctionExecutionInput ¶ added in v1.16.0
type FunctionExecutionInput = payload.FunctionExecutionInput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type FunctionExecutionOutput ¶ added in v1.16.0
type FunctionExecutionOutput = payload.FunctionExecutionOutput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type FunctionInput ¶
type FunctionInput struct {
Args map[string]string `json:"args,omitempty"`
Data []byte `json:"data,omitempty"`
Env map[string]string `json:"env,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
}
FunctionInput is the input passed to registered handler functions.
type FunctionInputMapping ¶ added in v1.16.0
type FunctionInputMapping = payload.FunctionInputMapping
Type aliases for extended (DAG) types re-exported from function/payload.
type FunctionNodeResult ¶ added in v1.16.0
type FunctionNodeResult = payload.FunctionNodeResult
Type aliases for extended (DAG) types re-exported from function/payload.
type FunctionOutput ¶
type FunctionOutput struct {
Result map[string]string `json:"result,omitempty"`
Data []byte `json:"data,omitempty"`
}
FunctionOutput is the output returned by registered handler functions.
type Handler ¶
type Handler func(ctx context.Context, input FunctionInput) (*FunctionOutput, error)
Handler is the function signature for registered handlers.
type LoopInput ¶ added in v1.16.0
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type LoopOutput ¶ added in v1.16.0
type LoopOutput = payload.LoopOutput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type OutputMapping ¶ added in v1.16.0
type OutputMapping = payload.OutputMapping
Type aliases for extended (DAG) types re-exported from function/payload.
type ParallelInput ¶ added in v1.16.0
type ParallelInput = payload.ParallelInput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type ParallelOutput ¶ added in v1.16.0
type ParallelOutput = payload.ParallelOutput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type ParameterizedLoopInput ¶ added in v1.16.0
type ParameterizedLoopInput = payload.ParameterizedLoopInput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type PipelineInput ¶ added in v1.16.0
type PipelineInput = payload.PipelineInput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.
type PipelineOutput ¶ added in v1.16.0
type PipelineOutput = payload.PipelineOutput
Type aliases re-exported from function/payload for convenience. External callers can use function.FunctionExecutionInput instead of function/payload.FunctionExecutionInput.