worker

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPInit

func HTTPInit()

HTTPInit initializes global parameters of HTTP workers by configuration values.

Configuration keys prefixed by "dispatch_" are considered.

Types

type Config

type Config interface {
	NewWorker() Worker
}

Config is an interface of a builder of Worker.

type HTTPWorker

type HTTPWorker struct {
	UserAgent string
	Logger    *zerolog.Logger
}

HTTPWorker is a worker which handles a job as an HTTP POST request to the URL specified by the job.

func (*HTTPWorker) NewWorker

func (worker *HTTPWorker) NewWorker() Worker

NewWorker creates a new HTTP worker instance which inherits the configurations of the current one.

func (*HTTPWorker) Work

func (worker *HTTPWorker) Work(job jobqueue.Job) *jobqueue.Result

Work makes a POST request to job.URL and returns the result.

type Worker

type Worker interface {
	Work(job jobqueue.Job) *jobqueue.Result
}

Worker is an interface of a worker which handles a dispatched job.

Jump to

Keyboard shortcuts

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