worker

package module
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTaskPoller

func NewTaskPoller(conf WorkerConfiguration, wg *sync.WaitGroup) *taskPoller

Types

type RetryPolicy

type RetryPolicy string
const RETRY_POLICY_BACKOFF RetryPolicy = "BACKOFF"
const RETRY_POLICY_FIXED RetryPolicy = "FIXED"

type Worker

type Worker interface {
	Execute(map[string]any) (map[string]any, error)
	GetName() string
	GetPollInterval() int
	BatchSize() int
}

type WorkerConfiguration

type WorkerConfiguration struct {
	ServerUrl                string
	PollInterval             int
	MaxRetryBeforeResultPush int
	RetryIntervalSecond      int
}

type WorkerConfigurer

type WorkerConfigurer struct {
	// contains filtered or unexported fields
}

func NewWorkerConfigurer

func NewWorkerConfigurer(conf WorkerConfiguration, wg *sync.WaitGroup) *WorkerConfigurer

func (*WorkerConfigurer) RegisterWorker

func (wc *WorkerConfigurer) RegisterWorker(w WorkerWrapper, numWorkers int) error

func (*WorkerConfigurer) Start

func (wc *WorkerConfigurer) Start()

func (*WorkerConfigurer) Stop

func (wc *WorkerConfigurer) Stop()

type WorkerWrapper

type WorkerWrapper struct {
	Worker
	// contains filtered or unexported fields
}

func NewDefaultWorker

func NewDefaultWorker(w Worker) *WorkerWrapper

func (*WorkerWrapper) WithRetryCount

func (w *WorkerWrapper) WithRetryCount(count int) *WorkerWrapper

func (*WorkerWrapper) WithRetryInterval

func (w *WorkerWrapper) WithRetryInterval(retryInterval int) *WorkerWrapper

func (*WorkerWrapper) WithRetryPolicy

func (w *WorkerWrapper) WithRetryPolicy(policy string) *WorkerWrapper

func (*WorkerWrapper) WithTimeoutSeconds

func (w *WorkerWrapper) WithTimeoutSeconds(timeout int) *WorkerWrapper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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