asynq

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultWorkerConfig = asynq.Config{

	Concurrency: 10,

	Queues: map[string]int{
		"critical": 6,
		"default":  3,
		"low":      1,
	},
}

Functions

func ParseRedisURI

func ParseRedisURI(connURI string) (asynq.RedisConnOpt, error)

Types

type Asynq

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

func New

func New(redisOptions asynq.RedisConnOpt) (*Asynq, error)

func (*Asynq) Client

func (a *Asynq) Client() *asynq.Client

func (*Asynq) Close

func (a *Asynq) Close() error

func (*Asynq) Handle

func (a *Asynq) Handle(pattern string, handler asynq.Handler) *Asynq

func (*Asynq) HandleFunc

func (a *Asynq) HandleFunc(pattern string, handler func(context.Context, *asynq.Task) error) *Asynq

func (*Asynq) Send

func (a *Asynq) Send(task *asynq.Task, options ...asynq.Option) (*asynq.TaskInfo, error)

Send Create a task with task type and payload task := asynq.NewTask("send_welcome_email", map[string]interface{}{"user_id": 42}) options: - asynq.MaxRetry - asynq.Queue - 指定队列名称 - asynq.Timeout - asynq.Deadline - asynq.Unique - errors.Is(err, asynq.ErrDuplicateTask) - asynq.ProcessAt - 指定处理时间 - asynq.ProcessIn - 指定延后时长

func (*Asynq) SendBy

func (a *Asynq) SendBy(typeName string, payload []byte, options ...asynq.Option) (*asynq.TaskInfo, error)

func (*Asynq) ServeMux

func (a *Asynq) ServeMux() *asynq.ServeMux

func (*Asynq) Server

func (a *Asynq) Server() *asynq.Server

func (*Asynq) SetRedisOptions

func (a *Asynq) SetRedisOptions(redisOptions asynq.RedisConnOpt) error

func (*Asynq) StartWorker

func (a *Asynq) StartWorker(configs ...*asynq.Config) error

func (*Asynq) Use

func (a *Asynq) Use(mws ...asynq.MiddlewareFunc) *Asynq

type Task

type Task = asynq.Task

func NewTask

func NewTask(typename string, payload []byte) *Task

Jump to

Keyboard shortcuts

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