worker

package
v0.19.771 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 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"`

	// 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