asynq

package
v0.0.0-...-65008d1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: AGPL-3.0 Imports: 7 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)

func RedisOptFromCache

func RedisOptFromCache() (asynq.RedisConnOpt, error)

func Send

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

func SendBy

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

func SendJSON

func SendJSON(typeName string, payload interface{}, options ...asynq.Option) (*asynq.TaskInfo, error)

func StartWorker

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

func WorkerHandle

func WorkerHandle(pattern string, handler asynq.Handler) error

func WorkerHandleFunc

func WorkerHandleFunc(pattern string, handler func(context.Context, *asynq.Task) error) error

Types

type Asynq

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

func Default

func Default() *Asynq

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) SendJSON

func (a *Asynq) SendJSON(typeName string, payload interface{}, 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 RedisClientOpt

type RedisClientOpt = asynq.RedisClientOpt

type RedisClusterClientOpt

type RedisClusterClientOpt = asynq.RedisClusterClientOpt

type RedisFailoverClientOpt

type RedisFailoverClientOpt = asynq.RedisFailoverClientOpt

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