Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.19.1255 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsWorker

func AsWorker(f any) any

func New

func New(v *validator.Validate, opts ...workerOption) (*worker, error)

func WithActivity

func WithActivity(act interface{}) workerOption

func WithConfig

func WithConfig(cfg *Config) workerOption

func WithContextPropagator

func WithContextPropagator(propagator workflow.ContextPropagator) workerOption

func WithLogger

func WithLogger(l *zap.Logger) workerOption

func WithMetricsWriter

func WithMetricsWriter(mw metrics.Writer) workerOption

func WithNamespace

func WithNamespace(ns string) workerOption

func WithWorkers

func WithWorkers(f any) any

func WithWorkflow

func WithWorkflow(wkflow interface{}) workerOption

Types

type Config

type Config struct {
	// builtin configuration
	Env         config.Env `config:"env" validate:"required"`
	ServiceName string     `config:"service_name" validate:"required"`

	GitRef  string `config:"git_ref" validate:"required"`
	Version string `config:"version" validate:"required"`

	// temporal configuration
	TemporalHost                                   string `config:"temporal_host" validate:"required"`
	TemporalNamespace                              string `config:"temporal_namespace"`
	TemporalTaskQueue                              string `config:"temporal_task_queue" validate:"required"`
	TemporalMaxConcurrentActivities                int    `config:"temporal_max_concurrent_activities" validate:"required" faker:"oneof: 10,20"`
	TemporalMaxConcurrentWorkflowTaskExecutionSize int    `config:"temporal_max_concurrent_workflow_task_execution_size" validate:"required" faker:"oneof: 10,20"`
	TemporalMaxConcurrentActivityTaskPollers       int    `config:"temporal_max_concurrent_activity_task_pollers" validate:"required" faker:"oneof: 10,20"`
	TemporalMaxConcurrentWorkflowTaskPollers       int    `config:"temporal_max_concurrent_workflow_task_pollers" validate:"required" faker:"oneof: 10,20"`
	// TemporalCPBuildMaxConcurrentActivities caps how many control-plane build
	// activities (git clone + OCI pack) a single worker pod runs at once. It is
	// deliberately separate from TemporalMaxConcurrentActivities so builds do
	// not inherit the 10k orchestration default and exhaust pod CPU/disk.
	TemporalCPBuildMaxConcurrentActivities int `config:"temporal_cp_build_max_concurrent_activities" validate:"required" faker:"oneof: 10,20"`

	// observability configuration
	HostIP               string `config:"host_ip" validate:"required"`
	LogLevel             string `config:"log_level"`
	SlowQueryThresholdMS int    `config:"slow_query_threshold_ms"`
}

Config defines the standard workflow worker config, which all workers should embed as part of their application.

type Worker

type Worker interface {
	Run(<-chan interface{}) error
}

Jump to

Keyboard shortcuts

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