worker

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupUI

func SetupUI(router *nrhttprouter.Router, opts *UIOpts)

Types

type Enqueuer

type Enqueuer interface {
	EnqueueUniqueTask(*Task) error
	EnqueueUniqueTaskIn(*Task, time.Duration) error
}

func NewEnqueuer

func NewEnqueuer(opts *EnqueuerOpts) Enqueuer

type EnqueuerOpts

type EnqueuerOpts struct {
	PoolSize int
	RedisUrl string
}

type Handler

type Handler struct {
	TaskName    string
	HandlerFunc asynq.HandlerFunc
}

type Middleware

type Middleware interface {
	ProcessTask(context.Context, *Task) error
}

type Queue

type Queue struct {
	Name     string
	Priority int
}

type Task

type Task struct {
	Name    string
	Retry   int
	Timeout time.Duration
	Payload interface{}
}

type UIOpts

type UIOpts struct {
	Username string
	Password string
	Endpoint string
	RedisUrl string
}

type Worker

type Worker interface {
	Start(context.Context) error
	RegisterHandlers([]*Handler)
	Stop()
}

func NewWorker

func NewWorker(opts *WorkerOpts) Worker

type WorkerOpts

type WorkerOpts struct {
	PoolSize        int
	RedisUrl        string
	Concurrency     int
	Queues          []*Queue
	ShutdownTimeout time.Duration
}

Jump to

Keyboard shortcuts

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